Hi! I want to change the UVMap of a geometry ingame, but I don’t find where I can change it.
I have a textureAtlas:
And two UVMaps in Blender:
The first UV (named UV1) make my cube look like this:
And the second (named UV2):
When I load the .blend and convet it to .j3o, it appear with the UV1. Now I want to change the UV used. Where I can find this? I look into the geometry:
geom.getMesh().getBufferList();
But it only has one buffer with the type TexCoord:
If you have multiple UV maps in blender, when importing to JME it will just import one UV map.
You can get what you want in this way :
You can change the texture by changing it in material parameter :
You need to first Get material from your geometry
JME3 supports up to 8 different uv maps (texCoord, texCoord2,…, texCoord8)
However only the lighting.j3md material uses this feature, and in a verylimited way. Only the light map support the use of a secondary uv map, so it won’t help you there.
If you want to switch uv map, you’ll have to do your own shader. Start with unshaded, and just use the inTexCoord, inTexCoord2 and switch from one to another using a material parameter.
The problem isn’t if it supports it or not, the problem is that the texCoord buffers aren’t loading. I’ve configured two UVs on blender but when loading only the first UV is loading (the mesh only have one texCoord buffer). If the buffers aren’t there, I can’t use them :S.
I configure them like:
You could just load it multiple times (one for each version) in some kind of preimporter you write yourself, then merge them together before saving as j3o.
the blender importer will import only the first available UV coordinates set if you have the texture applied.
However if you have no textures but you defined UV coordinates - then the buffers of user defined UV’s will be added to the mesh (I think there was such a request long time ago )
If you want I could just add a buffer of each user’s UV coords set to the mesh (up to 8 buffers of course).