JME renders surfaces as smoothed


I have exported objects from blender to JME using HottBJ exporter. The problem is that JME renders flat surfaces of objects as if they were smooth.  How can I set JME to render the surfaces as flat? Please see two attachements to see how JME renders the object (squareInJME.png) and how it should look (SquareInBlender.jpg).

My light code looks like this:

DirectionalLight dLight = new DirectionalLight();


dLight.setDiffuse(new ColorRGBA(1, 1, 1, 1));

dLight.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.7f, 1));

dLight.setDirection(new Vector3f(-0.8f, -1f, -0.8f));

        LightState lightState = DisplaySystem.getDisplaySystem().getRenderer().createLightState();

        lightState.setEnabled( true );

        lightState.attach( dLight );

        gameState.getRootNode().setRenderState( lightState );


Try applying a ShadeState and setting it to ShadeMode.Flat

Although, I dunno, the normals look a bit off in the imported jme model…


With this help the square is now shaded flat. :slight_smile: However, it seems that there is still something funny going on. I am expecting to see more consistent color, like in blender. Any ideas what could be wrong? I also included the blender file for this object.

Turn on normal line debugging (if you're using simple game - just press n). Pretty sure it looks like the normals aren't correct on that mesh. I don't use that pipeline, but usually what you'd want to do is flip normals in blender (or perhaps change smoothing settings), or recompute them when importing to jme.


For my eyes the JME normals look weird, but I am not sure. However, if I look normals at blender, they look ok (I previously attached also the blender file).

Does it seem like there is a bug somewhere, perhaps in HottBJ exporter?

jme(actually opengl) ussese opposite normals as blender. you have to invert them in blender or you need to recalculate them.

Empire Phoenix said:

jme(actually opengl) ussese opposite normals as blender. you have to invert them in blender or you need to recalculate them.

I am not so sure about that actually, empire phoenix. This seems either a normalization/scale issue or HottBJ export issue. Printing out the normals would help I think.

Well try exporting it as obj then and test if it look alright then. At least for me the obj importer always worked without problems.

   private Node precacheOBJ(String modelpath) throws IOException {
        URL objFile = Thread.currentThread().getContextClassLoader().getResource(modelpath);
        ObjToJme converter=new ObjToJme();
           int split = modelpath.lastIndexOf("/");
           String parentpath = modelpath.substring(0,split+1);
           URL parentdirectory = Thread.currentThread().getContextClassLoader().getResource(parentpath);
        ByteArrayOutputStream BO=new ByteArrayOutputStream();
        Node r = new Node();
        r.attachChild((Spatial) BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray())));
return r;


Does the object exporting mean blender's wavefront (.obj) exporter?

Yes that one should be the obj exporter.


There is a clear difference when using wavefront (.obj). As far as I see, wavefront works ok. Thanks. :slight_smile:

btw. What is the best/recommended exporter to bring objects from blender to JME? Is it wavefront? Clearly HottBJ has problems with even simple objects.