So, in the Hello Material tutorial, I got the example code working properly using both setting the material properties in the code, and also using a .j3m file. But when I try to do the same with an Object, the j3m results in a skewed texture. Example:
Regular way:
Material catMat = new Material(assetManager,
“Common/MatDefs/Light/Lighting.j3md”);
catMat.setTexture(“DiffuseMap”,
assetManager.loadTexture(“Models/cat/cat_diff.tga”));
cat.setMaterial(catMat);
That works. My cat has fur and eyeballs.
But when I create this file, MyCatMaterial.j3m:
Material shiny cat material : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap : Models/cat/cat_diff.tga
}
}
Now the texture is all skewed sideways on the cat and it has an eyeball in it’s ear. The “way” it’s skewed looks like it’s exactly along the cat’s ZY Plane, bisecting the cat. Now, this cat object is a .j3o file that I created, and the cat comes with other files too like .mtl, .obj, .g3db…
Do I need to set some texture coordinates or…something when using the .j3m material I made???
got this issue today still using jme 3.0, UVs are messed up when loading through j3m…refactored an existing j3m to the model I am testing now, so I know the j3m is “good” but the mapping gets broken for this model in particular when using j3m…the model itself will be discarded from the project, but I want to know how to fix it if I encounter it again
I don’t know how a material can influence the texture coordinates in any way, except it uses a different/faulty shader. Maybe you load different images with the j3m?
Well it seems that I will have to either stomach the mangled textures until I change the model or recreate a manual loading constructor for instances when models break with j3m as a workaround…because if you don’t know, I doubt that I will find the issue