The sides of my model disappear when I'm inside it

I have a roughly cone-shaped model which I made in Rhino, imported to Blender, and exported as an OgreXML mesh. I’ve loaded the model into my jME3 program and from the outside it looks good, but when I try going inside the cone the cone disappears. I’m fairly certain it’s not due to my frustum, as I’ve played around with those values quite a bit. Also, if I just export the model from Rhino as an .obj file and load that, then everything works fine. Does anyone know what the problem might be?



Thanks!

Did you consider back-face-culling? If not try to set the cull hint to never.

That’s what I was thinking, but I’m not sure how to set the cull mode without applying a material to the model. What kind of material definition would I use for a model?

The cull hint is set to a Spatial. So i think you have to traverse through the scene graph and set all spatials-> setCullHint(CullHint.Never), no special material.

Ah ok, thanks. Unfortunately, I did that for my model and the root node (the only two Spatials in the game) and I still have the same problem.

This is the default behaviour for models, if you want to go “inside” a model it should have an inside with normals pointing inside as well, you basically need a wall inside too. For an elephant this doesnt make much sense, but you can disable backside culling (on the cost of your GPU) like this:

[java]geometry.getMaterial().getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack);[/java]

What normen means is this:

[java]geometry.getMaterial().getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);[/java]

Thanks, but if I don’t have a geometry how do I do that? I just have a Spatial, which my model is loaded into. Should apply a material to the Spatial and do



[java]mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack);[/java]



?



Thanks very much for all the help, it’s much appreciated!

You most definitely have a Geometry somewhere, otherwise there would be no mesh or material. Spatial is only the base class.

[snippet id=“13”]

Ohhhhhh I get what’s going on now! That worked great, thanks very much everyone!

What went wrong? Please share your experiences with us. Perhaps other guys will have the same problems you do.

I just looked at the output and realized that jME3 makes a Geometry when I load the model as a Spatial, which is how normen’s code example can work. The geometry (in my case) is just the name of the mesh.xml file with -geom-1 after (and without the .mesh.xml extension).



My code for loading the model is this -



[java]Node cockpit = (Node)assetManager.loadModel(“Models/Obj_000001_mat0.mesh.xml”);

Geometry geom1 = (Geometry)cockpit.getChild (“Obj_000001_mat0-geom-1”);

geom1.getMaterial ().getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);[/java]



Also, the OgreXML exporter calls the material file something other than the mesh by default, which is why initially jME3 wasn’t applying my texture settings - in my case, I had to make sure the .material file was named ‘Obj_000001_mat0.material’