Import Google SketchUp models into jME3

All,



I’m loading Google SketchUp models into a jME3 app by export from GS as .OBJ, then using AssetManager.loadModel(). The place where I run into an issue is that the .OBJs include polygons, and OBJLoader says:



[java]

if (vertList.size() > 4 || vertList.size() <= 2)

logger.warning(“Edge or polygon detected in OBJ. Ignored.”);

[/java]



and



[java]

// face, can be triangle, quad, or polygon (unsupported)

[/java]



It seems like my options are to:


  • Understand the jME3 code and issues well enough to modify it to support polygons (and give back to the community)

  • Write a converter that will convert the polygons to a series of triangles and quads

  • Export as a different format that jME more fully supports

  • Find a converter that will convert Sketchup files to .OBJ without using polygons



Can someone offer advice as to what my short path is here?

Live rendering only works with triangles anyway, so for game models you’d have to go the triangle way anyway.

After posting this, I found an answer. Google Sketchup has an option in the export to OBJ, “Triangulate all faces,” which, when enabled, doesn’t use any complex polygons. I also enabled “Export two-sided faces,” and that improved the results when viewing.

There’s also an OgreXML exporter that works pretty well. I have actually used it for a big project so I know it works good

<3 Ogre exporter :slight_smile:

“Export two-sided faces,” and that improved the results when viewing.


As an alternative, you can turn off face culling for the model. Should yield the same results :

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

Excellent, thanks for all the help, folks. Sounds like I need to stare the Ogre in face. :wink: