Diffuse Overlay

Hi, using instructions from eightonegulf (http://hub.jmonkeyengine.org/forum/topic/texture-with-alpha-overlay/) I managed to get a material that has a diffuse overlay working fine. I also edited it to make it use the seperate texture coords which is fine.

However, this is only when I open the material in the JME SDK editor and click DiffuseOverlay and set it there. If I do it in code

mat.setTexture(“DiffuseOverlay”, blood4);

Which is what I need to do, it does not line up properly anymore (regardless of the seperate texture coords bit, even without those changes it wont line up). I used the exported UV layout as an overlay so you can see what I mean about lining up

First is with setting via editor, second setting with code

Is there something else I need to change to be able to set it from code properly?

Maybe try to flip the blood4 texture.
Load it with a TextureKey tk = new TextureKey(“path/to/texture”,true);// the second parameter to true flips the texture.
then go load the texture with the textureKey.

That’s strange though, not sure why you have it right in the SDK and not in code.

1 Like

Setting flipped to false fixed it, seems it was flipping automatically, thanks!

Also while you’re here… I didn’t want to start another thread for this question

Model, 3 seperate textures that make up an animation to be put on it. Assuming the model is low poly count and that’s not a problem, am I better off changing its material every frame, or making 3 seperate models, one for eadch material, and then culling so only 1 model is visible at a time with the correct texture in the aniamtion sequence? (Worried chaning material every frame will slow things massively)

You’d better change the texture of its material, it’s not as much expensive as you seem to think. And it’s way easier to handle in your code

1 Like

K, thanks for the help.