Hi ,in short, i did a model with material and texture . If i try to load it like “Ninja” in guide it lads every thig fine ,but when i try to split load it ,it blows up.
Material parameter is not defined: DeffuseMap
is last exeption i getting
I followed guide on import
I went in props and got material in generated this is the code :
public String modelMesh=“Models/222/Cube.mesh.j3o”;
Node MyCube = (Node) assetManager.loadModel(modelMesh);
Geometry geom = (Geometry) MyCube.getChild(0);
Mesh mesh = geom.getMesh();
MyGeometryBasic cube = new MyGeometryBasic(nomeClasse,1,"Sweet Home", mesh);
cube.setLocalTranslation(spatial.getLocalTranslation().getX(),
spatial.getLocalTranslation().getY(),
spatial.getLocalTranslation().z);
cube.setLocalScale(size);
try {
Material mat1 = new Material(assetManager,"Common/MatDefs/Light/Lighting.j3md");// "Common/MatDefs/Light/Lighting.j3md"
System.out.println(mat1);
mat1.setTexture("DeffuseMap",
assetManager.loadTexture("Models/222/MENU.jpg"));
System.out.println(mat1);
cube.setMaterial(mat1);
} catch (Exception e) {
System.out.println("starts here");
e.printStackTrace();
}
MyCityBuilder.MainGameClass.abitazioni.attachChild(cube);
oh and i i do not try to setTextures it doese not go down,just shows no object(may be it goes invis i dont know)
here is what i have in material
Material MyMaterial : Common/MatDefs/Light/Lighting.j3md {
MaterialParameters {
DiffuseMap : Repeat Models/222/MENU.jpg
GlowColor : 0.0 0.0 0.0 1.0
Specular : 0.5 0.5 0.5 1.0
Diffuse : 0.64000005 0.64000005 0.64000005 1.0
UseMaterialColors : true
ParallaxHeight : 0.05
Ambient : 0.8 0.8 0.8 1.0
Shininess : 12.5
}
AdditionalRenderState {
FaceCull Back
Wireframe Off
DepthWrite On
PolyOffset 0.0 0.0
AlphaTestFalloff 0.0
Blend Off
PointSprite Off
ColorWrite On
DepthTest On
}
}
You have a typo. It’s “DiffuseMap
”.
Also, if you have a Material pre made, you can instead do:
Material m = assetManager.loadMaterial("Materials/MyMaterial.j3m")
and save yourself a couple of lines of code. No need to set textures again, then.
Thnx,but some how they go invisible dont know why
Do you have a light in your scene?
in blender or in jMonk. ?
jMonkeyEngine. If you’re using the Lighting material, it requires a light to be there. Try adding an AmbientLight and see.
Also, is abitazioni
attached to the rootNode?
Yeah it was light ,thynx wery mutch i spent whole day on it i wonder if there a way to avoid dipendence on light,when i made a model it went to diffuse map it self(or at least i wasnt doing it soo intentionally)
You can use the Unshaded material definition for that. Believe me, I’ve made the same mistake a couple of times. Especially when it’s been a while since I worked on something
1 Like
Damn having some probs,it go inverted if i use unshaded from jM,and i cant use my mat as unshaded
WTF?! is this thing trolling,right now it crushed ,then i restarted and i works fine now ???,may be spending 17 hours on pc is not healthy … but i think this thing plays with me