Hi, I am adding some meshes for a human face. My problem is that when I set the materials as unshaded I can see the whole shape of the human face. The FaceCullMode of the material is off.
Here I left the code to add the meshes to the scene and the screenshots of how meshes are displayed depending on the material.
[java]public void fillRootNodeWithMeshes(Model3DSubFile model3dSubFile,CustomRanAccFile iffRandAccFile) throws IOException{
List<Mesh> meshList=IffUtils.createJme3MeshPartsListFrom3DSubfile(model3dSubFile, iffRandAccFile);
Material mat = new Material(assetManager,
"Common/MatDefs/Light/Lighting.j3md"); // create
mat.setBoolean("UseMaterialColors",true);
mat.setColor("Diffuse",ColorRGBA.White); // minimum material color
mat.setColor("Specular",ColorRGBA.White); // for shininess
mat.setFloat("Shininess", 64f); // [1,128] for shininess*/
/*Material mat= new Material(assetManager,"Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Gray);*/
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
List<Geometry> geomList= new ArrayList<Geometry>();
//Creates the Geometrys List
int i=0;
Geometry geom;
for(Mesh mesh: meshList){
geom=new Geometry("Part"+i,mesh);
i+=1;
geom.setMaterial(mat);
geomList.add(geom);
}
//Create a node to manage all the parts as a group
Node modelNode= new Node("Model3dNode");
//Attach the Geometrys to the root node
for(Geometry geometry: geomList){
modelNode.attachChild(geometry);
}
System.out.println("modelNode world translation: "+modelNode.getWorldTranslation().toString());
//Atach the Model3DNode to the rootNode
rootNode.attachChild(modelNode);
for(Spatial children: rootNode.getChildren()){
System.out.println("rootNode children: "+children.getName());
}
System.out.println("fillRootNodeWithMeshes: "+rootNode.getChildren().toString());
}
[/java]