Texture filter prior to loading model

Hi.



When loading a model that contains embedded materials:



[java]

Spatial model = assetManager.loadModel(“test.obj”);

rootNode.attachChild(model);

[/java]



… the textures are obviously loaded using whatever the default MinMagFilter and MaxMagFilter are.



What’s the correct way to set these texture parameters?

Ok, so I can get the model texture via a rather twisted and model-specific set of calls:



[java]

Node model = (Node) assetManager.loadModel("test.obj");

Geometry geom = (Geometry) model.getChild("test-geom-0");

MatParam m = geom.getMaterial().getParam("DiffuseMap");

Texture2D t = (Texture2D) m.getValue();

t.setMinFilter(MinFilter.NearestNoMipMaps);

t.setMagFilter(MagFilter.Nearest);

rootNode.attachChild(model);

[/java]



But it makes no difference. I think the texture is probably already loaded before I

can set the Min/Mag filter.

I tell a lie, selecting the correct geometry did it (for some reason it was the second one in the exported model).

1 Like