[Work around found]Yet Another Import Problem (Blender 2.63->j3o)

Hi All,



Running nightly, updated yesterday.



I’ve got a (fairly complex but not extreme - 552 vertex) model that I’ve just completed in latest Blender 2.63. I can’t get it into JME3 at all though.



First I tried the direct blender importer. This seemed to work but the result was a .j3o file containing a node called “Merged” (the name of the object I’ve created inside the blender file) Node but no geometries within that node. I then tried triangulating the model in blender and importing again - same result.



IDE Logs for the import:

[java]INFO [com.jme3.scene.plugins.blender.objects.ObjectHelper]: Loading obejct: Merged

INFO [com.jme3.scene.plugins.blender.objects.ObjectHelper]: Importing mesh.

INFO [com.jme3.scene.plugins.blender.materials.MaterialHelper]: Loading material.

INFO [com.jme3.scene.plugins.blender.textures.TextureHelper]: Reading texture from file: //MatchPlayerBaseTextureRed.jpg

INFO [com.jme3.scene.plugins.blender.materials.MaterialHelper]: Materials name: {0}

INFO [com.jme3.scene.plugins.blender.BlenderModelLoader]: Merged: (1.7025626, -2.4741974, 4.986301)–> null

INFO [com.jme3.scene.Node]: Child (Merged) attached to this node (Models/MatchPlayerBase.lighting.triangulated.blend)[/java]



Show “Importing Mesh” and no errors.





When I view the object in the scene composer I just see black with the point lights (which I’m going to delete anyway as they were just used for baking in lighting) and no geometry.









So I then thought I’d try via Ogre XML. I installed the scripts but inside the blender plugins it gave a warning about .mesh output requiring OgreCommandLineTools. I installed them and added the folder to a path and verified they work from a new command prompt but the warning stayed - however I managed to get the export option to appear in the menu so I thought I’d try it anyway and I got an error:

[java]


exporting root -> <bpy_struct, Object("Merged")>
Traceback (most recent call last):
File "C:UsersTimAppDataRoamingBlender FoundationBlender2.63scriptsadd
onsio_export_ogreDotScene.py", line 4509, in execute
def execute(self, context): self.ogre_export( self.filepath, context ); ret
urn {'FINISHED'}
File "C:UsersTimAppDataRoamingBlender FoundationBlender2.63scriptsadd
onsio_export_ogreDotScene.py", line 4791, in ogre_export
xmlparent=doc._scene_nodes
File "C:UsersTimAppDataRoamingBlender FoundationBlender2.63scriptsadd
onsio_export_ogreDotScene.py", line 4901, in _node_export
if ob.type == 'MESH' and len(ob.data.faces):
AttributeError: 'Mesh' object has no attribute 'faces'

location:<unknown location>:-1

location:<unknown location>:-1[/java]


This error doesn't seem to be anything to do with the command line objects...


As a last try I tried exporting to 3ds and importing back from that - which did work fine (I don't have 3ds but the re-imported model in blender looked correct)...So I know the object can be exported. I then tried one last export to Ogre3d and import in the SDK of that file which had been via 3ds but got the same result in both.

So...any suggestions? I'm running out of things to try!

Thanks,
Z

Looks like this may be the same problem as http://hub.jmonkeyengine.org/groups/import-assets/forum/topic/export-an-abject-from-blender-to-jmonkeyengine/



If I downgrade blender to 2.62 should that solve the problem? Will blender 2.62 open a 2.63 save file itself?

Found a work around!



In blender 2.63 if you triangulate the mesh (ctrl T) and then “save as” there are some options to tick at the left one of which is Legacy Mesh Format.



If you tick that then the resulting save can be opened in the SDK and converted to j3o - and I see my model correctly in scene composer.

4 Likes

Thanks for finding it :slight_smile: This will allow people to use Blender 2.63 until BMesh is supported by the importer :slight_smile:

@Kaelthas said:
Thanks for finding it :) This will allow people to use Blender 2.63 until BMesh is supported by the importer :)


Yes, although I do still have one problem:



Something seems to have scrambled the UV mappings, or normals, or both or something... You can see weird triangular artifacts all over the image in scene composer (it also looks wrong when I put the uv mapped texture on).

Any ideas?

Try “recalculating normals outside” if that doesn’t do it its bad modeling I guess. Look that you only use quads while modeling (they also work great with subsurfaces), triangles will cause the funny things you notice here. Always try to create the whole model using extrusion only, things like creating meshes from intersections and sewing etc. will cause nasty vertex combinations.

You can also try ‘Remove doubles’ option in Blender. This will remove unnecessary vertices.

And if nothing helps then give the link to the model and I’ll check it out.

I really need BMesh support. This is my primary feature request, as i use blender as world editor.

I’ve had a look at the normals in blender and I can’t see any that are obviously wrong. I already did a remove doubles recently as well. I’ve uploaded the model to my website, I’ll send you a link Kaelthas. In the meantime is there any way to view the normals in the SDK?

I’ve had a look at the normals in blender and I can’t see any that are obviously wrong. I already did a remove doubles recently as well. I’ve uploaded the model to my website, I’ll send you a link Kaelthas. In the meantime is there any way to view the normals in the SDK?

I just had a quick overview of the Bmesh/ngon thing in blender 2.63

It does bring a lot of very nice modeling tools, but in the end your model should not have ngons if you are willing to import it in jme.



The automatic triangulation is nice because it’s just a key press…but it messes up your mesh really.

IMO you should make a clean quad based model.


@zarch said:
I've had a look at the normals in blender and I can't see any that are obviously wrong. I already did a remove doubles recently as well. I've uploaded the model to my website, I'll send you a link Kaelthas. In the meantime is there any way to view the normals in the SDK?

you can't in the SDK but you can in the engine, look at this test case http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/light/TestTangentGen.java


@mifth said:
I really need BMesh support. This is my primary feature request, as i use blender as world editor.

The engine won't. Most engine works with triangles anyway.
The blender loader could triangulates your meshes automatically, but IMO it's a waste of time since blender can do it...

Some suggestions from Kaelthas have improved things, and looking more closely in Blender I have actually managed to find some “wrong” normals. It looks like there are a few invisibly tiny polygons with inverted normals buried in the mesh somewhere. Now I just need to find a way to get at them and fix/remove them.



My experience doing this model has indeed shown me that boolean operations are bad, but I’m really not sure how I’d achieve nice curves and regularly spaced bars etc using just extrude…

@nehon , i dont need nGons in JME. But i need triangles and quads. At present, I cannot load even triangles with BMesh.



Is it possible to add support of BMesh triangles and quads?



Edited: Or triangulate only nGons?

@mifth



Have you tried the work around I described above? Triangulate your model then tick the “legacy mesh format” when you save your model (its in the save as dialog).

Yeah man it works thanks. But I would like to have BMesh support too.

@mifth said:
But I would like to have BMesh support too.

This is kind of nonsense, those have to be "triangulated" on export as well. You will never get these into a game engine without doing that. So not much difference if its done in blender or by the exporter.
@normen said:
This is kind of nonsense, those have to be "triangulated" on export as well. You will never get these into a game engine without doing that. So not much difference if its done in blender or by the exporter.

Ogre exporter can triangulate nGons. Can JME-Blender importer triangulate nGons too?
@mifth said:
Ogre exporter can triangulate nGons. Can JME-Blender importer triangulate nGons too?

The Blender loader, is getting better and better every day, but there is still more work to do, and adding ngon triangulation to @Kaelthas's todo list knowing blender does it by pressing a hot key seems to be a waste of time to me.
@nehon said:
The Blender loader, is getting better and better every day, but there is still more work to do, and adding ngon triangulation to @Kaelthas's todo list knowing blender does it by pressing a hot key seems to be a waste of time to me.

Ok, but can we add triangles and quads support? for BMesh.

:facepalm: