How to add second texture into loaded 3ds model


I have an object 3ds loaded with his native texture. The TextureState has been created by loader and i can not handle this, there is no method to return a TextureState from a Node.

I would like to add second texture to the Node(for example an environment mapping texture). I can not find an information how can i do this.

I'm sure some of You has faced such problem, maybe i coud get some help.


TextureState ts = (TextureState) model.getRenderState(RenderState.RS_TEXTURE);

If this returns null, the TextureState is probably applied further down the scenegraph. You can use this tool: to inspect your scenegraph, or this one:;topicseen#msg51789 if you prefer a more graphical view. The first one is much more comprehensive though.

Sry i can not manage to find it. There is also null on Spatial an TriMesh.

Let me describe me problem little deeper:

My files are:

-model.3ds (one node without childrens)




I'm loading the first texture (testure_diffuse.jpg) while loading the model by ResourceLokatorTool, that's why the TextureState is given automatically.

All i want to do is:

-read the TextureState given to the node by modelloader

-add next units to the TextureState

but how can i do this if even Spatial and TriMesh giving me null when i call

Spatial s=(Spatial)mynode;
TextureState ts=(TextureState) s.getRenderState(RenderState.RS_TEXTURE);

Have you tried the first scenegraph inspection tool yet? It might be a bit difficult to read at first, but then shows you exactly where in your scenegraph which kind of RenderStates are applied. And about anything else there is to say about your scenegraph. Try it, it is very handy!

Yes, i used JMETreeModel and it show me:

TDS Scene (com.jme.scene.Node)
  monster (com.jme.scene.Node)
    monster##0 (com.jme.scene.TriMesh)

But how can it help me? Still i can not get TextureState of this model (calling get Texturestate from TriMesh gives me null). Also i can't remove the renderstate... nothing...

I can't undestand why, when i add the texture manually, i can read the TextureState without any problems; and when i use the ResourceLocatorTool, the same Node give me null. The information is moved to the graphic memory and deleted from RAM?

I was refering to the SceneGraphDump tool in my last post. Use that, not the JMETreeModel, to examine RenderStates.

Hevee, i have it:)

Thank You very much. I wish to buy You a beer:)