Importing blender model into jME

Hi,

can anyone tell me the easiest way to import a blender model into jME ? i’ve tried various ways, but none worked…

(i’m a noob with blender and with 3d engines… so … i have no idea about it all … just wanted to try if i can import my test model …)

i tried exporting the blender model into 3ds… jME threw:


java.lang.ArrayIndexOutOfBoundsException: 0
   at com.jme.scene.model.XMLparser.Converters.TDSChunkingFiles.TDSFile.putChildMeshes(TDSFile.java:292)
   at com.jme.scene.model.XMLparser.Converters.TDSChunkingFiles.TDSFile.buildObject(TDSFile.java:169)
   at com.jme.scene.model.XMLparser.Converters.TDSChunkingFiles.TDSFile.buildScene(TDSFile.java:73)
   at com.jme.scene.model.XMLparser.Converters.MaxToJme.convert(MaxToJme.java:43)
   at net.sphene.spacecombat.client.gui.JMEGui.simpleInitGame(JMEGui.java:52)
   at com.jme.app.SimpleGame.initGame(SimpleGame.java:329)
   at com.jme.app.BaseGame.start(BaseGame.java:63)
   at net.sphene.spacecombat.client.gui.JMEGui$1.run(JMEGui.java:32)



i also tried to export the model to MD2:


java.lang.NullPointerException
   at com.jme.scene.TriMesh.setIndices(TriMesh.java:246)
   at com.jme.scene.model.XMLparser.JmeBinaryReader.readBegining(JmeBinaryReader.java:218)
   at com.jme.scene.model.XMLparser.JmeBinaryReader.loadBinaryFormat(JmeBinaryReader.java:111)
   at com.jme.scene.model.XMLparser.JmeBinaryReader.loadBinaryFormat(JmeBinaryReader.java:140)
   at net.sphene.spacecombat.client.gui.JMEGui.simpleInitGame(JMEGui.java:53)
   at com.jme.app.SimpleGame.initGame(SimpleGame.java:329)
   at com.jme.app.BaseGame.start(BaseGame.java:63)
   at net.sphene.spacecombat.client.gui.JMEGui$1.run(JMEGui.java:32)



i've got the blender exporters from: http://bane.servebeer.com/programming/blender/
(i also tried to export it to ac3d but this crashed blender... - and i couldn't find a working .obj exporter)

if anyone is interested, here is my test model: http://kahless.yourhell.com/dev/tmp/SC2spaceship1_05_forimport2.blend (the original version: http://kahless.yourhell.com/dev/tmp/SC2spaceship1_05.blend)

so.. any ideas how i can import it into jME ?

thanks in advance & cu
Herbert Poul

Keless from Elysiun ?



maybe not…



I made a boring, hard-to-read post here th eother day about level editing tools for jME, and one posibility -that i like- is Blender.



But that was a proposal to make it more customized so with special boxes, portals, collision boxes, pawns, etc, could be built visually by the artist, and exported by a python script made to run inside Blender.



BTW: If is for levels, objects, anything without bones nor animation, go for OBJ export.



Best plugin is at blender.org, in their foums, specifically do a “search” (teh forum search, not the one above, which searchs in all blender.org, but not in the forums…) limitting the search in parameters to “Interface & tools” forum section, and restricting to “Author” ideasman…



What the heck, I’ll paste you the direct links…but remember to check the thread, as he updates there the plugin…this one is already very good, I work with it :



" Importer now imports inline ‘usemap’ keywords to assign UV textures, MTL export has changed a bit.

Bugfix where only the last object had materials applied to it was fixed.

http://members.iinet.net.au/~cpbarton/obj_import.py



Exporter now exports MTL files, as well as UV image textures.

http://members.iinet.net.au/~cpbarton/obj_export.py



Its now possible to export a large scene with materials and UV mapping/images

And import it- keeping all the properties supported by obj.



Please dont use the old OBJ I/O, these have some important Bugfixes."





Blender, for characters, have it very polished now…

export of md2 (working well, I tested) , md3(also) , *.x (also, I recommend this one: http://www.mindfloaters.de/blender )



For statics, level , object…use those OBJ scripts posted above… :slight_smile:

The 3ds loader is scetchy for all the essoteric formats so don’t use it unless you’re making the model from scratch. The obj should work. I’ll take a look and see if I can’t get it to load from there

The *.3ds format by itself, indeed, is terrible. Is only good if you compare it with dxf.



3ds breaks the smoothing when finds a vertex with two UVs (any of the UV chunk borders, that is, constantly) No long materials names supported, and 65k triangles limit.



Opposite to this, the great OBJ support huge tri count models (I have tested gmax exporting an OBJ witha home made script of 100,000 and + polygons mesh…! ) . It does support a vertex having 2 UVs, it has much better normals support (including smooth groups ), is ascii, so can be parsed, have an appart ascii file, mtl, for material settings, and overall, is better spread in packages.



hmmm…remeber: While this plugin for blender I mentioned use to pick the material, uv and texture automatically, when you for example import an already UV mapped OBJ model INTO Blender, which already has an mtl file, and texture asigned…it must all be in same folder. Even so, I have experienced sometimes the need of reassigning the texture, and setting it in certain blender menu to grab its original UVs and not generate automatic ones.



If you read the related sections of the Blender doc http://blender.org/modules.php?op=modload&name=documentation&file=index (is the pain-less way to learn Blender. the other is if u have worked with many modellers and play guessing, that’s what I did.Even in this case, in some moments, the manual is a need.) … the material reasign doing so is quite easy. A model that has been made from scratch in Blender, finds no problems(neither the other case, if u import the obj in Blender just u may need to relink the texture, that i meant) in export with this Ideasman plugin. What i am not sure is how good is the one included in the today or yesterday oficial new release, 2.35… You know, several formats are already incldued, but in some cases are not the best exporters, while best exporters are scripts u have to dig a bit for…