Page 1 of 18

Made a B3D Loader

Posted: Fri Jul 21, 2006 4:19 am
by Luke
Hi, I am a new user to irrlicht, I only really started using it last week, but I have been using blitz basic for years.

I tried out the examples of irrlicht and found the animations looked very poor compared to blitz basic.

So I wrote a b3d file loader for Irrlicht.

So far it plays animations smoothly (interpolated frames, weighted vertices), and can also load light mapped meshes.

Transitions between animations are not yet done, I will need a custom IAnimatedMeshSceneNode to get it to work.

And one or two functions don’t yet work.



Image

(Edit: File is out of date and the loader has been included with the new version of irrlicht)

Download:
ftp://codedrop%40gdlib%2Enet:codedrop@c ... Loader.zip

if that fails:
http://www.uploading.com/en/?get=K3VYIQNJ

I am a beginner at C++ programming, so please help me improve this loader.

I’m happy for people to do what ever they like with it.

Any feedback welcome

Posted: Fri Jul 21, 2006 7:27 am
by vermeer
WOW

A hundred of congrats!

There are *tons* of free and comercial lightmappers exporting as b3d!
It packs the whole level thing!

People, grab this now


Also animated meshes!!!!!
(a question...while b3d format I think supports spline interpolation, like x, the dx7 old blitz3d engine did only supported linear, for the dx limits I think...are you supporting to grab the spline interpolation, the curves, from the 3d package? there are great exporters for character animation in b3d format in Character Fx, Max, Ultimate Unwrap, etc...)

Really.Outstanding.
Some of the experts in code here, please play with it, so to help the man in possible issues, etc...do so now that he's attending the thread ;)

Do not make him wait...!

Please!
Don't let this post buried...!

edit - Masters of the C++ language ;)...help him! In case is needed...

Posted: Fri Jul 21, 2006 7:55 am
by Luke
vermeer: Thanks,
It should be pretty easy to add spline interpolation (only a change in the formula, and getting the key frames) but right now it is only using linear interpolation. I may make an option of picking which to use at runtime.

Posted: Fri Jul 21, 2006 8:45 am
by JPulham
WHOA! JUST WHAT I NEEDED!!!
I was going to write my own one but I couldn't be bothered so just used DeleD :roll:
good work... thanks

Posted: Fri Jul 21, 2006 9:07 am
by hybrid
From a first glance I'd say code is definitely not bad. However I'd prefer to have the changes being presented more compact: Try to move your changes into the SVN version of Irrlicht (instructions to get the code are on the project page and elsewhere in this forum). Then you can make a patch file with 'svn diff >b3dloader.patch'
For hosting you should contact bitplane and put it onto gdlib.net.

Posted: Fri Jul 21, 2006 9:14 am
by vermeer
maybe he gets a bit lost trying to achieve that...As probably is not familiar with it.


Luke, spline interpolation is what translates stuff like feet not sinking, or a real clothes , hair or othe rmovements as natural and organic as were created (provided that thecode imports the exact curves made...)

Other possibility is the artist baking all frames to keyframes, or every two frames, but it gets really hd memory heavy and maybe cpu overloading files... (I dunno if would be the case)

Posted: Fri Jul 21, 2006 11:31 am
by Luke
hybrid:
I have never used SVN but I'll try.

vermeer:

My b3d loader uses linear spline interpolation like blitz basic (which is used only to save cpu usage not the dx limits as it is done in the engine, not the driver/hardware (I think))

Are talking about (Quadratic/Cubic/others..) spline interpolation where 3, 4 or more key frames are used to make a curve (smoother movement), then yes I know want you mean

linear interpolation needs bigger files but is easier on the cpu (then spline interpolation), and still looks ok, but I will try and add spline interpolation later with an option of picking which to use at runtime.

Posted: Fri Jul 21, 2006 11:55 am
by hybrid
As soon as you have the code from SVN it's really nothing different than working with the old Irrlicht code. You just get some updates by others from time to time :)
And to get the code there are several tools out there if you don't use command line...

Posted: Fri Jul 21, 2006 2:09 pm
by vermeer
I don't know if is really possible...What i mean is whaty I observed the md5 exporter from Blender does...it takes the ipo curves and seem to translate as they are in the 3d package: if there was an ease in aproaching a keyframe, it is ported as it was, with that exact curve...It affects how much traslation and in which axe more or less between one keyframe and the following...are curves per axe (x,y, z) each ported as they were at the 3d pacakge. This allows a 1:1 output in the engine....

wasn't the refering to put an standard average smoothing curve, I think...

This perhaps is extremely complex to code...

Anyway, the loader does already an amazing number of things...

Posted: Sat Jul 22, 2006 3:54 am
by afecelis
whoa! someone finally made it! :shock: :shock:

you can't imagine the doors you've opened!

Thanks a ton Luke!

sniff! sniff! I knew this day would come....some day... can't think clearly now... I'm all tears of emotion....:P

@ the SVN team: this should be merged into the src, is it possible?

Posted: Sat Jul 22, 2006 4:41 am
by afecelis
Luke I tried loading one of my b3d scenes (created in Giles, 3dworldstudio and Deled) and none of them loaded. The app compiles ok but when trying to load the b3d file it crashes and launches that "dwwin" thingie. To make sure, I reloaded yours and It loads ok. Is there a poly limit or something that may be making my levels crash? Or perhaps only Maplet b3d files are accepted? dunno...any ideas?
EDITED: I thought it was the missin _lm in the lightmaps so I lightmapped my level again in Giles, corrected the lightmap names and re-exported but nothing. Everything loads ok, but then the app crashes.
Image

Posted: Sat Jul 22, 2006 5:17 am
by Luke
Afecelis: Have you got it to work with other b3d files?, if not you know that you cannot just use the “Irrlicht.dll” with your programs as the Library file and include files are different, so you need to compile the source to get the new library file and change the irrlicht’s include files (make backups first).

If it is only the one b3d file, can you send me the b3d file that is crashing the program?

Edit: try renaming your b3d mesh to test.b3d and run my example

Edit:
dwwin:
http://www.hardavenue.com/a/dwwin.exe.php
Maybe it is dwwin causing the problems?

Hybrid:
Is this what you mean?
http://www.uploading.com/?get=V7TUVLGG

Posted: Sat Jul 22, 2006 5:50 am
by Emil_halim
:D Luke good luck,that very good work ,hope that you can finish this project.

Posted: Sat Jul 22, 2006 10:32 am
by hybrid
Luke wrote:Hybrid:
Is this what you mean?
http://www.uploading.com/?get=V7TUVLGG
Probably, however they won't let me get the file :cry:
I'll keep trying, but maybe you can send it to me by mail? My address is on my webpage.

Posted: Sat Jul 22, 2006 12:58 pm
by afecelis
@Luke: yup I recompiled the engine using your source and I'm using the proper dll (btw, do you have an MSVC project as well?). Your file loads perfecly ok and i tried 3 different b3ds of mine.

Here's a shot of my b3d as seen in blitz3d:
Image

and here's the file for you to test it out:
http://afecelis.gdlib.net/Blitz3d/mymap.zip

here's the temple scene I created for Irrlicht loaded in blitz as well (couldn't resist trying it out in blitz3d!!):
Image

and here's the b3d file to try (also crashes):
http://afecelis.gdlib.net/Blitz3d/temple02.zip

and finally, here's the 3rd file. A test model I created to lightmap in Giles and load in blitz3d:
Image

b3d file here (also crashes):
http://afecelis.gdlib.net/Blitz3d/hallway.zip