Last shot before I throw in the towel ...

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
BlendThis
Posts: 4
Joined: Sat Jun 17, 2006 10:06 am
Location: Paris, France

Re:

Post by BlendThis »

Oh you know Bitplane, this is me who thanks you and all who contribute to all of this.

I post my tutorial as soon as possible.
BlendThis
Posts: 4
Joined: Sat Jun 17, 2006 10:06 am
Location: Paris, France

Re: Last shot before I throw in the towel ...

Post by BlendThis »

I investigated a bit further the problem,

As suggested above by AndyCR, in fact, Mindfloaters exporter (mod 1.3.2) seems to work perfectly for non animated meshes, with Blender 2.41 and Irrlicht 1.0.


You can find Mindfloaters DirectX Exporter Mod 1.3.2 from the following url:

http://development.mindfloaters.de/

"Download" section, then "DirectX Exporter Mod 1.3.2".

Related Python script is named "DirectX8ExporterMod.py".


When using this script as it is, I obtain the following error message in the console:

----
Traceback (most recent call last):
File "<string>", line 1526, in ?
SystemError: error return without exception set
----

(I use Python 2.4.3)



To make it work, in the concerned Python script (DirectX8ExporterMod.py), you may just have to replace the following lines (lines 1526 and 1527) :

if obj.getData().getMode() & NMesh.Modes['SUBSURF']:
subsurf = True

With:

# if obj.getData().getMode() & NMesh.Modes['SUBSURF']:
# subsurf = True


The fact of commenting out these 2 lines will disable subsurfs detection, so under Blender it's preferable (in Object mode and while the mesh is selected) to do Alt C (Convert Object type, then "Delete Original") before exporting.


Also, apparently, "Flip z" is the only needed option.


This is certainly, for the moment, the best solution for exporting non animated meshes so that it work under Irrlicht 1.0, insofar as you won't have to move the mesh center, nor to use any other trick.

Mindfloaters DirectX Exporter Mod 1.3.2 was done for Blender 2.37, so it may work for some animated meshes if you use Blender 2.37 and the Python version that was in use then.

However, it doesn't seem to allow to export animations when you are under Blender 2.41 with Python 2.4, probably because this script contains several deprecated functions.


At this stage, i can't figure out what is wrong with Ben's exporter for Blender 2.41.

An advantage of Ben's exporter is that it can export animations properly.

The only problem seems to be that it doesn't calculate appropriate vertice/normal/texture coordinates (and the trick i described in my first post, a few posts above in this thread - that is to say moving the mesh center, permits to get this round, so that the mesh be displayed correctly. But that's just a trick, which can cause new problems when handling the mesh under Irrlicht).

I compared several .x files obtained from Mindfloaters exporter with the equivalent ones obtained from Ben's exporter, and the only instance where both contain close values is when you export a simple cube (the cube that is displayed by default when you run Blender).

In the case of the cube, I get 23 vertices in the .x file obtained from Mindfloaters exporter, against 24 vertices in the .x file obtained from Ben's exporter.

Here are the "Mindfloaters" .x file mesh vertices and normals for the Blender default cube (exported with only "Flip z axis" option checked) :

----
Meshobject{
23
1.000000;1.000000;1.000000;,
1.000000;-1.000000;1.000000;,
-1.000000;-1.000000;1.000000;,
-1.000000;1.000000;1.000000;,
1.000000;0.999999;-1.000000;,
0.999999;-1.000001;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;1.000000;-1.000000;,
1.000000;0.999999;-1.000000;,
0.999999;-1.000001;-1.000000;,
1.000000;-1.000000;1.000000;,
1.000000;-1.000000;1.000000;,
0.999999;-1.000001;-1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;-1.000000;1.000000;,
-1.000000;-1.000000;1.000000;,
-1.000000;-1.000000;-1.000000;,
-1.000000;1.000000;-1.000000;,
-1.000000;1.000000;1.000000;,
1.000000;0.999999;-1.000000;,
1.000000;1.000000;1.000000;,
-1.000000;1.000000;1.000000;,
-1.000000;1.000000;-1.000000;;

MeshNormals{
23;
0.577349;0.577349;0.577349;,
0.577349;-0.577349;0.577349;,
-0.577349;-0.577349;0.577349;,
-0.577349;0.577349;0.577349;,
0.577349;0.577349;-0.577349;,
0.577349;-0.577349;-0.577349;,
-0.577349;-0.577349;-0.577349;,
-0.577349;0.577349;-0.577349;,
0.577349;0.577349;-0.577349;,
0.577349;-0.577349;-0.577349;,
0.577349;-0.577349;0.577349;,
0.577349;-0.577349;0.577349;,
0.577349;-0.577349;-0.577349;,
-0.577349;-0.577349;-0.577349;,
-0.577349;-0.577349;0.577349;,
-0.577349;-0.577349;0.577349;,
-0.577349;-0.577349;-0.577349;,
-0.577349;0.577349;-0.577349;,
-0.577349;0.577349;0.577349;,
0.577349;0.577349;-0.577349;,
0.577349;0.577349;0.577349;,
-0.577349;0.577349;0.577349;,
-0.577349;0.577349;-0.577349;;
----


And the "Ben" .x file ones (only "Flip z" option checked, and exported with "Export Sel" button) :

----
Mesh {
24;
1.000000; 1.000000; -1.000000;,
1.000000; -1.000000; -1.000000;,
-1.000000; -1.000000; -1.000000;,
-1.000000; 1.000000; -1.000000;,
1.000000; 1.000000; 1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000; -1.000000; 1.000000;,
1.000000; -1.000000; 1.000000;,
1.000000; 1.000000; -1.000000;,
1.000000; 1.000000; 1.000000;,
1.000000; -1.000000; 1.000000;,
1.000000; -1.000000; -1.000000;,
1.000000; -1.000000; -1.000000;,
1.000000; -1.000000; 1.000000;,
-1.000000; -1.000000; 1.000000;,
-1.000000; -1.000000; -1.000000;,
-1.000000; -1.000000; -1.000000;,
-1.000000; -1.000000; 1.000000;,
-1.000000; 1.000000; 1.000000;,
-1.000000; 1.000000; -1.000000;,
1.000000; 1.000000; 1.000000;,
1.000000; 1.000000; -1.000000;,
-1.000000; 1.000000; -1.000000;,
-1.000000; 1.000000; 1.000000;;

MeshNormals {
24;
0.577349; 0.577349; -0.577349;,
0.577349; -0.577349; -0.577349;,
-0.577349; -0.577349; -0.577349;,
-0.577349; 0.577349; -0.577349;,
0.577349; 0.577349; 0.577349;,
-0.577349; 0.577349; 0.577349;,
-0.577349; -0.577349; 0.577349;,
0.577349; -0.577349; 0.577349;,
0.577349; 0.577349; -0.577349;,
0.577349; 0.577349; 0.577349;,
0.577349; -0.577349; 0.577349;,
0.577349; -0.577349; -0.577349;,
0.577349; -0.577349; -0.577349;,
0.577349; -0.577349; 0.577349;,
-0.577349; -0.577349; 0.577349;,
-0.577349; -0.577349; -0.577349;,
-0.577349; -0.577349; -0.577349;,
-0.577349; -0.577349; 0.577349;,
-0.577349; 0.577349; 0.577349;,
-0.577349; 0.577349; -0.577349;,
0.577349; 0.577349; 0.577349;,
0.577349; 0.577349; -0.577349;,
-0.577349; 0.577349; -0.577349;,
-0.577349; 0.577349; 0.577349;;
----

Under Irrlicht 1.0 Meshviewer, the cube exported with Ben script seems not to be distorted at all.


For more complex objects, .x files obtained from Ben's exporter tend to have many more vertices and normals than the equivalent .x files obtained from Mindfloater's exporter, and the vertices and normal coordinates are quite different in both cases.

Concerning 23yrold3yrold's mesh, there are 36 vertices in the .x file exported with Mindfloaters script, against 192 vertices in the equivalent .x file exported with Ben's script.

When i basically copy/paste the mesh vertices and normals from a "Mindfloaters" .x file to an equivalent "Ben" .x file, then there is no more mesh distortion when i check out the result under Irrlicht 1.0 Meshviewer.


I'll compare the two Python scripts, in order to see how to change Ben's code so that it work properly under Blender 2.41, with Python 2.4.



Ben's exporter for Blender 2.41 can be found from here:

http://www.ben.3rdimension.co.uk/

"DirectX Exporter" section, then "Get the Exporter(.py file)".

Related Python script is named "DirectXExporter241.py".
Last edited by BlendThis on Thu Jun 22, 2006 12:00 am, edited 2 times in total.
BlendThis
Posts: 4
Joined: Sat Jun 17, 2006 10:06 am
Location: Paris, France

Re: Last shot before I throw in the towel ...

Post by BlendThis »

I have good news for you!

All of this was caused by the spaces that are after the semicolons... It works under Directx Mesh Viewer, but Irrlicht doesn't seem to like it.

So, here's what will resolve the problem:

Open Ben's exporter (DirectXExporter241.py) under your favorite text editor (a good one imho: Scite, that can be found from http://www.scintilla.org), and within the script (except for the comments of course), replace every occurrence of the following string:

"; "

with:

";"


Then your exported .x meshes (including animated ones) should work like a charm under Irrlicht too.


Hoping it will help. :wink:
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

awesome, nice find. thanks again. I confirmed this by replacing all semicolons in earth.x with semicolon-space, resulting in this-
Image
I'll report this to the bugs forum

edit: continued here in bugs forum
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
23yrold3yrold
Posts: 11
Joined: Wed Apr 19, 2006 6:23 am

Post by 23yrold3yrold »

Absolutely fantastic find. 8) I'm happy to see a concrete cause was found for this.
Post Reply