Another model rendering problem, this time very tricky!

Hi everyone,
i’ve modeled in blender a very basic pc mouse and imported to jmonkey engine, here is the very strange result:
“><img src=”<img src=“http://i.imgur.com/IuICbEb.jpg” title=“Hosted by imgur.com” />" alt="" />

The normals are ok, the material is the default blender material, the polygons are really simple…what’s wrong with jmonkey rendering?

Thoughts…

Try flipping the normals on all but the buttons, just to see what happens.

Verify that the face culling is properly set up on the material.

@t0neg0d said: Thoughts...

Try flipping the normals on all but the buttons, just to see what happens.

Verify that the face culling is properly set up on the material.

thanks for the reply.

I’ve flipped all the faces but…now i have all faces “solid” with top faces solid black! Very strange behaviour! In blender now i see the same strange behaviour of the image i’ve posted, but only in the viewport not when i render the model!

Face culling…ok, where? In blender or in jmonkey engine? And if in jmonkey engine how can i do that?

@gnerpo said: thanks for the reply.

I’ve flipped all the faces but…now i have all faces “solid” with top faces solid black! Very strange behaviour! In blender now i see the same strange behaviour of the image i’ve posted, but only in the viewport not when i render the model!

Face culling…ok, where? In blender or in jmonkey engine? And if in jmonkey engine how can i do that?

Quick question before I forget:

Are you converting the .xml to j3o?

Now… to ensure that face culling is handled right (in JME):

[java]
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back); // or Off
[/java]

Though, I’m doubting this is the issue.

The other thought I have is to create a test Material to see if the problem is the default Blender material (or importing of the material that is)… try:

[java]
Material mat1 = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
mat1.setColor(“Diffuse”, ColorRGBA.Blue);
mat1.setColor(“Ambient”, new ColorRGBA(0,0,0.25f,1));
mat1.setBoolean(“UseMaterialColors”, true);
[/java]

Make sure there is a light in your scene… this will rule out a problem with importing Blender materials (which I remember looking a little odd anyways)

Hi, i guess it could be the camera, do you try to move around. 2nd thought is the way BMesh is import is not right, normally a mesh which is trianguled will be imported without issues.

In your jMonkey render view in your first post, the body of the mouse has its vertexes wound backwards. Maybe the material is set for two-sided faces somehow?

As suggested, turning off back face culling or switching it to Front-culling will fix the visual issue but it’s really a model issue. I’ve had some meshes do this to me but I never really figured out why.

@pspeed said: In your jMonkey render view in your first post, the body of the mouse has its vertexes wound backwards. Maybe the material is set for two-sided faces somehow?

As suggested, turning off back face culling or switching it to Front-culling will fix the visual issue but it’s really a model issue. I’ve had some meshes do this to me but I never really figured out why.

Thank you all for the replies!
I’ve rebuilded the model (it was a simple one) and the problems are gone…! Mah!?

2 Likes

I had the same problem. there is a really easy fix. go into blender and put the object into edit mode with ‘TAB’. then press ‘Cntl N’ which will reset normals so they always face the right way! then re-export and then open in jmonkey. ezpz fix.