I am having trouble finding documentation on how to convert an ogre .material to a .j3m or .j3md.
I am looking for a way to change the texture of an Ogre XML Model like the Ninja sample model.
Thank you for your help.
Just import the model and edit the material:
http://hub.jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/how-to-modify-the-alpha-value-of-a-model/
@Normen Thank you very much
I was able to create a j3o and j3m file.
When I load the model without adjusting the texture it looks correct.
http://i.imgur.com/5s9N1.jpg
[java] Node marcher = (Node) assetManager.loadModel(“Models/new1/marcher.mesh.j3o”);
Material mat1 = assetManager.loadMaterial(“Models/new1/marcher.mesh-submesh0.j3m”);
// Texture mat1Text = assetManager.loadTexture(“Models/new1/marcher.jpg”);
// mat1.setTexture(“DiffuseMap”, mat1Text);
marcher.setMaterial(mat1);
rootNode.attachChild(marcher);[/java]
If I attempt to adjust the texture even with the same image as the one defined it has an issue with the texture mapping. I know I am missing something here I just don’t know what it is.
http://i.imgur.com/3E9Bu.jpg
[java] Node marcher = (Node) assetManager.loadModel(“Models/new1/marcher.mesh.j3o”);
Material mat1 = assetManager.loadMaterial(“Models/new1/marcher.mesh-submesh0.j3m”);
Texture mat1Text = assetManager.loadTexture(“Models/new1/marcher.jpg”);
mat1.setTexture(“DiffuseMap”, mat1Text);
marcher.setMaterial(mat1);
rootNode.attachChild(marcher);[/java]
My Material is
[xml]Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap : Repeat Models/new1/marcher.jpg
Specular : 0.0 0.0 0.0 1.0
Diffuse : 0.55 0.55 0.55 1.0
UseMaterialColors : true
ParallaxHeight : 0.05
Ambient : 0.55 0.55 0.55 1.0
Shininess : 95.0
UseAlpha : true
SeparateTexCoord : true
}
AdditionalRenderState {
FaceCull Back
Wireframe Off
DepthWrite On
PolyOffset 0.0 0.0
AlphaTestFalloff 0.0
Blend Off
PointSprite Off
ColorWrite On
DepthTest On
}
}
[/xml]
My texture is http://i.imgur.com/Imrd9.jpg
Thank you for your time
You might need to invert the texture when you load it manually.
Is there a way to invert the texture in the code?
I have been able to invert them externally and then load the image.
Yes, if you create the TextureKey manually you can specify to flip the texture… there are two different loadTexture() methods on asset manager.
Thanks I found it, works perfectly.
Just check the “flip” checkbox in the material editor next to the texture… :roll: