Made a B3D Loader

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Sorry about the delay, I had no time,

Vermeer:

ok,

Starting to get what you want,

First (from a bit of googling) blender only has 3 types of curves (interpolation)
Constant - Basally no interpolation
Linear – I using it now
Bezier - standard on blender

The editing of curves you’re talking about, I don’t know if it changes special values passed to the Bezier formula that change the shape of the curves or it adds/changes key frames (possibly even hidden ones).

It is probably faster (in fps) if the exporter baked frames as keyframes (no need to bake all of them, and the exporter can find out the type of interpolation your using and the settings on the curve) and the engine used a simpler interpolation on them. It extra file size is minimal (and zips well for the internet). Basic spline interpolation like character Fx (one of the few animators I can use) would still give you good results if the exporter baked frames as keyframes (no need to bake all of them). I look in to what your talking about later when the b3d loader is more complete.

The standard b3d files are not holding any info about the shape/values of the curve, they don’t ever state the type of interpolation to use on them but b3d files are very easily expendable (and backward compatible). The interpolation setting could also be set in the game, maybe so slower computers can use Linear interpolation and faster computers, spline interpolation or Bezier.


Hybrid:

Cool I got the changes you made off the SVN,

Some bugs of mine I found:

-B3dChunkHeader’s remaining_length had been deleted (I was not using it)

-When reading unknown chunks,
“file->seek(B3dStack[B3dStackSize].remaining_length-8,true);”
Won’t work and would crash if used, it is changed to,
“file->seek( (B3dStack[B3dStackSize].startposition + B3dStack[B3dStackSize].length) , false);”

-Added full bright FX (To stop black areas on lightmapped meshes)

-Before only the first node (and its children) would animate, now fixed


Download,
http://www.uploading.com/?get=R440508F
(not that well tested)

Some bugs of mine I have not fixed:

-Like I said last post OSReadSwapFloat32 is not a real command, I’m not sure what I should change it to but.

-Also vertex lighting is not working,
Objects will go black if setMaterialFlag(EMF_LIGHTING, false) is not used.
Last edited by Luke on Tue Jul 25, 2006 11:41 pm, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, I'll see if I can grab the file at home with my windows machine :cry:
The MacOSX thing just went through my review, I'm not that experienced with OSX and thus I just did not see that there's a wrong thing used. I think you can just use the Int32 version because it casts to pointers. We'll see if lingwitt proposes some fixes.
I think the lighting issue could be related to lightmaps. There are different lightmaps for those with or without dynamic light effects. But I though the difference would only be existant if dynamic light is on. Though I never used lightmaps, yet, and thus I'm not really familiar with it.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Hi Luke!

Any chance to get the loader files (cpp and header)?

mirrored the patch here:
http://afecelis.gdlib.net/Irrlicht/B3d_ ... 2529.patch
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

hybrid:

The lighting issue is with objects not using lightmaps, lightmapped meshes work fine now as there are set not to use lighting and are full bright. (Should I change to half bright to match blitz basic?)
(lightmapped meshes don’t use dynamic light, I’m not sure when the loader should set them with dynamic light)

Afecelis:

I upload them when I get home, but it is nothing more then bugs fixes.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, lightmapped meshes do not need dynamic light to get decent effects, but they can be affected by dynamic lights as well. But the problem might be due to missing normals (I saw that they can be loaded, maybe you have meshes without). So these have to be calculated if missing. Just pass the vertices of a triangle to plane3df and take its normal.
So changes are put to SVN (based on afecelis' hosting, I did not try to download them from somewhere else :wink: )
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

I agree lightmapped meshes do not need dynamic light to look good, just thinking that some people might want it anyway.


I was writing the code to calculate the normals but using the IMeshManipulator, only to find to could not get a pointer to it.
I'll just copy the IMeshManipulator's function's code and put it in then.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

"I agree lightmapped meshes do not need dynamic light to look good, just thinking that some people might want it anyway. "

I have heard that in other threads...Unreal 2003 engine, and many comercial games do have both lightmapped and dynamic lighting. It just looks better.

But anyway, how you do it is all up to your choice,Luke, as have the generousity to make it.

Good deductions about interpolation.

If the curve exact shape is not taken from the 3d package, by the plugin, whichever it is, then is not only not a gain , but a loss, if it adds random averaged spline interpoation...Better than that option, can be a bake of the curve as just many more keyframes.Which indeed would be closer to what is happenning in the package. And as you said, one does not need to bake all keyframes, just certain important ones. Is what I tend to do with b3d files when for the b3d engine.

There's no b3d export out of blender: I usually import x files from there at Ultimate unwrap and the export as b3d. Couldnt be sure now if this workflow is loosing actually in the proccess the curves's shape.

Looks like md5 exporter, tho, is keeping the curve shape, the shape of the bone ipos, I think. But that's another story.

So, well, baking is quite a possibility :)

if you ever are able to get those curve's shapes, cool, but thinking about it, I indeed am unsure if the package exporters for b3d are actually exporting them for this format..
Finally making games again!
http://www.konekogames.com
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

My wording was not very clear,
but what do you think about baking frames as keyframes in the editor AND using spline interpolation in the engine? The animation would only be off by the slightest (most cases better than linear) and would stop any of the jumps in the animation.


Also does anyone have the code for spline interpolation on quaternions, or would it work right with just Euler vectors?
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

Luke wrote:My wording was not very clear,
but what do you think about baking frames as keyframes in the editor AND using spline interpolation in the engine? The animation would only be off by the slightest (most cases better than linear) and would stop any of the jumps in the animation.
Good idea...If actually is a parameter that can be configured...'cause problem with non controlled curves , spline interpolation whose curves one hasn't forced to be in a way/shape, is...feet sinking in floor, hands not grabbing so accurately a weapon or a wall... unwanted floating...as is adding extra movement, -yep, very smooth, but..- in the 3 axes.

Yup, it looks way more life like,natural and organic but...It'd be cool if could b econtrolled by text or something how much of "curving" (in comparison to a total linear interpolation) would happen.
Anyway, if already keyframes were forced, baked, this will be disminished; yet tho, for experience animating, it'd be better if some way to control with general value of "smooth interpolation" is added. No matter if it'd be by a text file, or once in the engine or game code. After all, the baked keyframes are ensuring stuff...and yup, in the package, there's usually allway some spline interpolation, really is much more robotic without it(pure linear, not standard way in max/blender).
Finally making games again!
http://www.konekogames.com
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Hey guys! I was able to compile the b3d loader using MSVC hence trying out the levels in Directx and noticed something interesting. Using the country house sample (finca) you notice the windows are transparent looking outside-in but once you enter the main hall and look bak (180 degrees) you see this:
Image
It looks as if things with alpha were totally solid in their inner part, but it really is an overburned alpha (check the higher part of the door frame and you'll see a bit of the roof outside). Just like the "hallway" sample you mention Luke, totally overburned, giving the impression of being solid.

The I ran the app in DX and guess what?
Image

So it might not be much, but it definitely is an Opengl issue! :wink:
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Did you use Irrlicht 1.0 or Irrlicht SVN? Maybe it's also a problem with specular colors? these are fixed in latest SVN versions.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

I grabbed the SVN b3d files and placed them in the 1.0 (official) version. Recompiled and made the Opengl and DX test.

Just had this warning when compiling:

Code: Select all

CAnimatedMeshB3d.cpp(1321) : warning C4244: 'initializing' : conversion from 'double' to 'irr::f32', possible loss of data
Dunno if I should've replaced other source files as well (for the specular color thing). :wink:

Ironically, SVN has never compiled properly for me. :(
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

So no, then it's not specular colors as these were also enabled in SVN only. So it's maybe a problem with the OpenGL alpha channel material.
Compile problems should go into the SVN error thread :wink:
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

thanks! :) I also think it's a problem in OpenGl's alpha channel material.

And I'll give SVN another try to compile and post my errors in the other thread. :wink:
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

a silly idea, but can be possible in some conversion is converted to two sides, two faces? I am unsure if b3d indeed had a problem with 2 sided alpha rendering..unsure...but that can be b3d engine, really...and unsure even so...
Finally making games again!
http://www.konekogames.com
Post Reply