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.
23yrold3yrold
Posts: 11
Joined: Wed Apr 19, 2006 6:23 am

Last shot before I throw in the towel ...

Post by 23yrold3yrold »

Okay, I'll start from the beginning. I've been trying to work with Blender as an editor for models for Illricht (exporting models in .x format using the exporter at http://www.ben.3rdimension.co.uk/). But I'm still having a crazy time trying to get it to load/render properly. Here's all the info you could need. My model file and texture:

http://members.gamedev.net/23yrold3yrol ... linder.zip
http://members.gamedev.net/23yrold3yrol ... eelbox.bmp

Here's a pic of it in Blender:

http://members.gamedev.net/23yrold3yrol ... lender.PNG

Okay, nothing special. Export, load in DirectX Viewer:

http://members.gamedev.net/23yrold3yrol ... lender.PNG

Okay, okay, perfect, so far, so good. I load it up in the Hello, World! example program that comes with Irrlicht, just subbing my model for yours:

http://members.gamedev.net/23yrold3yrol ... licht1.PNG
http://members.gamedev.net/23yrold3yrol ... licht2.PNG
http://members.gamedev.net/23yrold3yrol ... licht3.PNG

Okay, now we got a problem. Do you see how it almost looks like it's rounding the coordinates? It's like it's almost got it but not quite. And I don't think the camera is anywhere near too close. Here's the DirectX model, texture is above:

http://members.gamedev.net/23yrold3yrol ... linder.zip

And here's the program, with some matrix code splattered in there so I could rotate the camera and really observe the fubarness (I'm sure Irrlicht has functionality for camera rotation, but I need code I know works right now. >_>). I included with and without the original comments, since while informative they tend to be distracting ....

http://members.gamedev.net/23yrold3yrol ... t/main.cpp
http://members.gamedev.net/23yrold3yrol ... mments.cpp

I'm throwing this on the Blender forums one more time too; I have this week reserved to finish up some work, mostly 2D, but I'd like to finally get my feet wet with some 3D. If this doesn't work I'm writing my own bloody engine. :twisted: Can someone please explain to me what's going wrong here?
AndyCR
Posts: 110
Joined: Tue Nov 08, 2005 2:51 pm
Location: Colorado, USA
Contact:

Post by AndyCR »

I get very strange display with that model in another program (Lightmap Maker) too, so I don't think it's Irrlicht's fault. I've heard the MindFloaters exporter is the best one for Irrlicht/Blender, you might try that.
hardgeus
Posts: 28
Joined: Tue May 23, 2006 12:55 am
Contact:

I don't think the problem is Irrlicht

Post by hardgeus »

The only success I've had in exporting *anything* from Blender is using Wavefront .obj, the exporter of which unfortunately does not support any form of animation. I have tried md2, cal3d, .x, and Directx8 .x, all to no avail. Note that exporting a md2 from Blender and then trying to re-import it still scrambled it, so it isn't an Irrlicht problem. Blender's plugins just suck. ...Don't be too quick to blame the issue on Irrlicht.
23yrold3yrold
Posts: 11
Joined: Wed Apr 19, 2006 6:23 am

Re: I don't think the problem is Irrlicht

Post by 23yrold3yrold »

hardgeus wrote:Don't be too quick to blame the issue on Irrlicht.
Oh, I'm not. I just find it odd that it loads flawlessly in DirectX's viewer. Is it possible I'm using the wrong options for the plugin? I like Blender because I'm used to it, but if you can suggest another good model/animation editor I can use for this, that would be awesome ....
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

The only way I have ever gotten my own model into Irrlicht is by exporting it from 3D Studio Max using the PandaX exporter. Exporting using PandaX has worked perfectly, with no problems at all. Just make sure you choose text-encoded when exporting using PandaX.
I still haven't found a way to get anything into Irrlicht if you don't have 3D Studio Max, though.
mR.haHN
Posts: 49
Joined: Wed May 03, 2006 5:37 pm

Post by mR.haHN »

Uhm, I use Milkshape and it works perfectly. Irrlicht supports the .ms3d format and so you dont even have to convert it somehow.
hardgeus
Posts: 28
Joined: Tue May 23, 2006 12:55 am
Contact:

Re: I don't think the problem is Irrlicht

Post by hardgeus »

23yrold3yrold wrote: I like Blender because I'm used to it, but if you can suggest another good model/animation editor I can use for this, that would be awesome ....
We're in the same boat. I'm determined to get Blender working. If I get anything to work I'll PM you. Let me know if you get it working.
hardgeus
Posts: 28
Joined: Tue May 23, 2006 12:55 am
Contact:

Post by hardgeus »

After looking at the python script itself, I noticed that my version of Blender (2.40) shipped with a 2.39 version of the exporter...There is a 2.41 version of the exporter that looks much better. I also found the author of the exporter's website:

http://www.omariben.too.it/

Here is a list of tips from that site:

-Tips for Irrlicht ,DarkBasic(& other engines) users:
-In order to import without problems meshes in engines as Irrlicht,DarkBasic etc.
1 - Open the .x file exported from Blender with Mview(the DirectX viewer which comes with DirectX SDK)
2 - Click on MeshOps-Vertex Selection
3 - Click over the mesh
4 - Again MeshOps-Weld Vertices
5 - Select the first 2 options "Remove Back To Back Triangles" and "Regenerate Adjacency"
6 - Then "Apply"
7 - Resave the mesh
-You must take care of the engine features,if they import materials or onlu uv mapped images,which image format imports etc....
-If you have experienced any other tip using this files on your engines,feel free to contact me.
The examples has been tested with Deep Exploration, Mview,3D Object Converter, and Irrlicht viewer.If you have troubles with exporting in .x file format for your engine or want to report any bug contact me at aromari@tin.it I would like to thank the guys who has contributed to this exporter(especially Oin(Extrudeface) from blender.org community)
23yrold3yrold
Posts: 11
Joined: Wed Apr 19, 2006 6:23 am

Post by 23yrold3yrold »

OKay, here's another thing which has come up before. What exactly is the filename for Mview, because I can't find it in my DirectX SDK folder. I have a program called dxviewer.exe, but there's no Save feature (or any kind of editing, obviously). Also, is there a way to just make sure the Blender model somehow adheres to certain rules before you export it? I guess I'll try and figure out that second one once I get this Mview thing and see if it does the trick ... also I'll check out that exporter ... EDIT: That just redirects me to the link I posted. :) So I have the right exporter ...

EDIT2: From the DirectX help file ...
This new tool replaces some of the functionality previously found in effectedit and mview. EffectEdit and MView will be deprecated in a future DirectX SDK release.
Lovely. :?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Maybe it's the software renderer that causes problems...use opengl or directx to see if it looks different
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
hardgeus
Posts: 28
Joined: Tue May 23, 2006 12:55 am
Contact:

Post by hardgeus »

23yrold3yrold wrote:OKay, here's another thing which has come up before. What exactly is the filename for Mview, because I can't find it in my DirectX SDK folder. I have a program called dxviewer.exe, but there's no Save feature (or any kind of editing, obviously).
OK, I can finally be useful! The mview.exe is here:

http://users.skynet.be/fa201614/irrlicht/mview.exe

I found it from this thread:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=11690

I have now successfully exported my player character mesh by loading it into mview and saving out. (Under Linux using Wine, no less).

I didn't check to see if animations were working, and the model is scaled pretty small, but it's there without errors, which is more than I could say with any other method.

I'm going to do some digging and try to figure out exactly what it is that the plugin is doing wrong which makes Irrlicht barf. I am absolutely *not* going to open/save my models in mview every time I want to export them.
23yrold3yrold
Posts: 11
Joined: Wed Apr 19, 2006 6:23 am

Post by 23yrold3yrold »

hardgeus wrote:I'm going to do some digging and try to figure out exactly what it is that the plugin is doing wrong which makes Irrlicht barf. I am absolutely *not* going to open/save my models in mview every time I want to export them.
You and me both, buddy, you and me both. :) It says the two options to set are "Remove Back To Back Triangles" and "Regenerate Adjacency", so I'm curious if there's some way to set the Blender model to do that in the first place before the export. Might make life easiest that way.

And yes, the steps you posted above worked for me too now that I have Mview. Model displays in the test program perfectly. At least I can play with Irrlicht on a small scale now ...
Kannon
Posts: 20
Joined: Wed Jun 14, 2006 7:27 am

Post by Kannon »

Does X export for you totally screw your UV coordinates?

If you want, I can send you the X export script I have, and you can compare it with yours, and maybe siphon the working code bits out of both and slap them together. I'll skim through the code as well, maybe newbie eyes willl get lucky.

Edit: I see what you mean by garbled.... it took me adding a Maya camera to see it when I examined the FUBARness of my texture.... Is OBJ an option? It's not animated... but the meshes and textures come through fine. At least enough to keep you playing with irrlicht until we can get this X mess resolved.

Edit Mk2: Is it possible.... Uncheck double sided, in the blender face options, recalculate normals outside, and maybe even triangulate your mesh.... maybe it'd work then?
"That is not dead which can eternal lie, And with strange aeons even death may die."
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 »

Hi 23yrold3yrold,

I tested your .blend file with blender 2.41 and Ben's 2.41 exporter, and I obtained exactly the same weird result than you when checking out the exported .x file with Irrlicht 1.0 Meshviewer.

After a few experimentations under Blender and Irrlicht, i would like to suggest you a first solution, if you want to keep using only Blender and Irrlicht.
It consists in moving the mesh "out of its center", so that the "center" be out of a corner of the mesh bounding box:

In Blender 2.41:

- While mouse cursor is over the 3d window, choose Orthogonal View (Numpad 5) and Right View (Numpad 3)
- In Object mode, select your mesh (with Right Mouse Button)
- Convert Object Type (Alt C), then choose "Delete Original". This might be useful in some cases, to avoid display problems in irrlicht, in particular if the mesh contains subsurfs (subdivision surfaces).
- Choose Edit mode (Tab key) (and make sure that "Draw faces" and "Draw Edges" be checked - on the right of the panel, to have greater visibility on what you're doing)
- Normally, all of the vertices are selected. If not, select all (A key)
- Grab (G key) and move selected vertices to the top and to the right of mesh center (you'll see that the center doesn't move)
- With the mouse cursor over the 3d window, choose Front View (Numpad 1)
- Grab (G key) and move the vertices to the right of mesh center (normally, they are already above the center)
- Choose Object mode (Tab key again)
- Make sure mesh is selected (Right Mouse Button)
- In Directx exporter for Blender 2.41, Export Sel (selected object)

Don't forget to make sure that "Flip z" is checked, to adapt the mesh to Irrlicht.

For instance, if you see, under Irrlicht, that your character has a weapon in the left hand, whereas he was supposed to have it in the right hand, this certainly means that you didn't check "Flip z" before exporting...

Each time you want to use the export script in a same Blender session, re-open the script before executing it. Or else it might not work properly.

If the mesh is animated, a 3D window must remain visible when using the script. If not, animation won't be exported (probably because of a bug in Blender).


This method seems to allow to display any exported mesh (even animated meshes) correctly under Irrlicht 1.0,
but after having moved mesh center, of course you'll have to add some little code if you want to apply proper rotations to your mesh under Irrlicht.



Here's another solution, that seems to work well too: add an armature, place it out of a corner of the mesh bounding box, and parent the mesh to the armature:

In Blender 2.41:

- While mouse cursor is over the 3d window, choose Orthogonal View (Numpad 5) and Right View (Numpad 3)
- In Object mode, select your mesh (with Right Mouse Button)
- Convert Object Type (Alt C), then choose "Delete Original". This might be useful in some cases, to avoid display problems in irrlicht, in particular if the mesh contains subsurfs (subdivision surfaces).
- Place the Blender 3D cursor (with Left Mouse Button) to the bottom and to the left of the mesh
- Add an Armature (Space key, then Add->Armature)
- Choose Object mode
- Make sure armature is selected (with Right Mouse Button)
- Choose Front View (Numpad 1), then grab (G key) and move the armature to the left of the mesh (normally, it's already below the mesh)
- Select mesh and armature (Right Mouse Button on the mesh, then Shift-Right Mouse Button on the armature)
- Ctrl A ("Apply size and rotation")
- Select the mesh (with Right Mouse Button), then, while pressing Shift key, select the armature.
- Parent the mesh to the armature (Ctrl P, choose "Armature", then "Don't Create Groups")
- Remove lamps, cameras, etc. if you dont need it (or else they will be exported too when you run the export script with "export all" option, even if you have moved them elsewhere with M key)
- In Directx exporter for Blender 2.41, Export All (I have tried "Export Sel" with mesh and armature selected, but it didn't work)

Don't forget to make sure that "Flip z" is checked, to adapt the mesh to Irrlicht.

Each time you want to use the export script in a same Blender session, re-open the script before executing it. Or else it might not work properly.

This second solution works with non animated meshes only.


This reply is rather about non animated meshes. In the next hours/days I may propose a tutorial, as complete as possible, describing how to prepare and export animated meshes under Blender 2.41, with Ben's last exporter, for Irrlicht 1.0.
Last edited by BlendThis on Thu Jun 22, 2006 12:06 am, edited 4 times in total.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Hey BlendThis, I'm sure I speak for everyone when I say thank you for this very useful information. I personally haven't tried getting X meshes from Blender into Irrlicht yet, but I wasn't looking forward to it given the convaluted workflows that have been described in the past!
I certainly am now though, and I'm also very much looking forward to a full tutorial if you are kind enough to make one for us
Thanks you very much for sharing :)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply