Made a B3D Loader

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

Post by Luke »

afecelis:

Testing out what you’re talking about,

It seems to turn from transparent to solid when the animated character is being drawn, try to load the level without anything other then the house mesh it works fine.

I’m not sure what is causing this, could be something I’m doing wrong or a rendering bug (especially if it is fine in Directx), but I don’t know.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Great luke, thanks for looking nto it. I do have some more things to report. I ended up compiling the full SVN source (1.1 alpha) and most of the things got fixed; only a couple of things grabbed my attention:
1. B3d compiled with msvc and using the opengl renderer is working fine; in windowed and fullscreen mode. but...
2. B3d compiled with GCC still has the problem when running in windowed mode. It doesn't show up if you set your app to run in fullscreen; weird, huh?

I'll doubcheck it with the hallway level, which was the one withthe most prbs.
:wink:

EDITED: The hallway level is a completely different problem. Its alpha is ok; it's just overburned all over. Remember how the first loadr showed stuff darker and then you gradually started to increase its brightness-contrast? What did you change for that?
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

The meshes are brighter because if the texture's Blend is 5 (Multiply 2), then the material is set to EMT_LIGHTMAP_M2 (All your meshes have this set)

I can compile with GCC and run openGL fullscreen fine, but I have not tested it much.

I still don't know whats with the hallway level, I have not had much time to look at it, maybe I've got it too bright so it is going full white?, Blitz Basic might be doing something different (its default ambient light is '127,127,127' but that does not seem to fix it)

Also I got transitions with the animations working so I can change from idle to a run smoothly (bit buggy I fix it when I get time), it looks cool but I had to change a fair bit of CAnimatedMeshSceneNode to get it to work which I don’t like, but I can’t find any other way to make it work. (By the way why is “setCurrentFrame(s32 frame)” empty in CAnimatedMeshSceneNode, is it not used?)

I also want to add the ability to merge two animations together (eg running and shooting), I already programmed it in the B3d animater but it needs to be controlled in CAnimatedMeshSceneNode, or I could make something like CAnimatedMeshSceneNodeB3D (thoughts?)

I’ll make this for me (I cannot think of many games where it’s not used) but I don't think I should make such big changes to Irrlicht, but do people what this, should it be coded in the other format’s animaters too.
vermeer
Posts: 2017
Joined: Wed Jan 21, 2004 3:22 pm
Contact:

Post by vermeer »

Cool afe!

Seen the lightmaps and all...tru that some windows had the over burnt white when looking from inside...


Cool, a whole anim and levels format.


This could clearly be great solution for many users :)


Now we need somebody to code a blender b3d exporter ;)

Anyway, those with unwrap3d, u can use Ben's plugin, import at U3d, export as b3d.

Or use Max Pipeline exporter, or Character Fx, etc.

For levels...any of the load exporting with it.

Cool, anims transitions....
Finally making games again!
http://www.konekogames.com
noone88
Posts: 49
Joined: Sat May 27, 2006 3:28 pm

Post by noone88 »

hi!

is there a way to get a joint transformation matrix? (like the ms3djoint node?)

I always have used Milkshape for animations. But the loader was damaging the files and nobody was interested in my fix so iam going to switch to b3d if there a way to attach a weapon to the hand.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

noone88:

Sorry I forget to add it, just made it then, it works fine,

I would upload a patch but the other changes I'm making are not finished (eg transitions) so it’s hard to right now.


Pretty easy:

Copy the functions of getXJointNode or getMS3DJointNode in CAnimatedMeshSceneNode.cpp and change MS3D or X to B3D, (note the SNV has EAMTS_B3D, My fault it should be EAMT_B3D, and I wrote IAnimatedMeshB3d not IAnimatedMeshB3D should also be fixed).

At the line “(Mesh->getMeshType() == EAMT_MS3D || Mesh->getMeshType() == EAMT_X”… of OnPostRender add “|| Mesh->getMeshType() == EAMT_B3D” (or EAMTS_B3D)

Add the function to the header’s of IAnimatedMeshSceneNode.h and CAnimatedMeshSceneNode.h

Done, I try and upload a patch later.

I have changed CAnimatedMeshB3d::getMatrixOfJoint in my code so the vertices are not recalculated only the joints are, which is much faster.


Also any reason why irrlicht cannot play loop animation backwards, I got it to work with only 3 extra lines, and nearly no speed loss. I think other people have done this too, any reason why there is no support for backwards animations (is it a design thing, to keep irrlicht simple)?

I also wrote a bit of code to get setCurrentFrame to work (the function was empty, or am I missing something?), I just change BeginFrameTime to a value that makes the animation at that frame, (it should work with all animation formats)
Edit: Searched the forum, seems like a know bug http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=64824


Edit:Cool I see setCurrentFrame's been fixed, being picky but in setCurrentFrame it has "BeginFrameTime = BeginFrameTime =", I know it makes no difference.

And the EAMTS_ thing is fixed too, cool.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

I didn’t expect the irrlicht release to be so soon…


I made a patch for the b3d loader, some changes:

-The normals are calculated if not found in the mesh file, should fix the lighting issue but will slow the loading down a bit.

-EmissiveColor is now set to 50%, I had in set to 0% before, but it many confuse some people (getting black meshes)

-You can set the Interpolation Mode, to constant or linear, sorry no spline interpolation yet

-Added getB3DJointNode to IAnimatedMeshSceneNode so you can attach a weapon to a hand, etc.

-The skin of mesh (vertices) and Bones are animated separately which gives a few benefits including making getMatrixOfJoint faster.

-I removed AddMatrixToJoint, it was not very use full and I’m going to make a proper system to move/rotate bones

-Merging animates is very incomplete.

-The loader can now animate transitions, but you cannot use it with the current CAnimatedMeshSceneNode.
I think I fixed the transition bug I was having, it’s still incomplete but have a look:

Download transition demo (WIP):

http://www.fileden.com/files/2006/8/10/ ... itions.zip

or

http://www.uploading.com/?get=2HFZJ8E6 (to download, find the button "free")



Download patch:

http://www.fileden.com/files/2006/8/10/ ... s09Aug.zip

or

http://www.uploading.com/?get=L5ZCB029

(Can someone please test it, including the changes)




Afecelis:

I think I’m reading the brushes (Materials) differently somehow to blitz basic and making the objects too bright, I can load the hallway mesh if I set no fullbright and no EMT_LIGHTMAP_M2.


Image
(Ignore the dwarfs)



And about the windows in the house with OpenGL, this post seems to be related to what’s happening:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=14312
The windows (for me at least) are fine with only one mesh being drawn.



Edit:

The patch is not working with the latest svn because of the revision:

148 by bitplane
“moved calculation of bone positions to CAnimatedMeshSceneNode::render() as per http://irrlicht.sourceforge.net/phpBB2/ ... php?t=8805

I try and upload another patch tomorrow.

The change is pretty cool because it means I can now get the right matrix from the function getB3DJointNode when transitions are playing.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

great Luke! Thanks for the patch and the info on EMT_TRANSPARENT_VERTEX_ALPHA

Hope your new version works with latest SVN so that Hybrid can merge your fixes! :D

Your anim transitions are working great as well.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

I’ll make a patch that works with the latest SVN soon, but I am still changing a few things with the animation transitions, so I don’t think it should all be merged yet, but the fixes with the normals and lighting can be.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

first off all , i would like to thank you for your good B3D loader.

i was playing with afecelis demo "b3d loader test drive" and found strange thing with getTransformedBoundingBox function when return the bounding box of B3d file , it does not return the correct points , so is this a bug or what.

thanks again for your great work
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Emil_halim:

Thank you for finding that, Yes it was a bug, I just fixed it then,


It you want the fix just change the old code at the end of CAnimatedMeshB3d::loadFile() to this:

if (Vertices.empty())
BoundingBox.reset(0,0,0);
else
{
BoundingBox.reset(Vertices[0]->Pos);
for (s32 i=0; i<(s32)Vertices.size(); ++i)
BoundingBox.addInternalPoint(Vertices->Pos);
}


I’ll make up a patch, with it.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

This is a pretty slow method, isn't it? You should have bounding boxes for the submeshes (at least most other meshes have) and thus you could calculate the bounding box from the 8 points of those boxes.
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

Hybrid:

Yeah it’s pretty slow, thanks for picking that out

And would you even need 8 points, correct me if I’m wrong but this should work too:

Code: Select all

if (Buffers.empty())
		BoundingBox.reset(0,0,0);
	else
	{
		BoundingBox.reset(Buffers[0]->BoundingBox.MaxEdge);
		for (s32 i=0; i<(s32)Buffers.size(); ++i)
		{
			BoundingBox.addInternalPoint(Buffers[i]->BoundingBox.MaxEdge);
			BoundingBox.addInternalPoint(Buffers[i]->BoundingBox.MinEdge);
		}
	}
Luke
Admin
Posts: 449
Joined: Fri Jul 14, 2006 7:55 am
Location: Australia
Contact:

Post by Luke »

I uploaded a new patch:

http://www.fileden.com/files/2006/8/10/ ... s16Aug.zip


Tell me if you have any problems as it is pretty untested and its late here.

The patch should now work with the latest SVN


I completely moved transitions to CAnimatedMeshSceneNode so transitions will work with other mesh formats (The transitions part is NOT included in this patch, because it is incomplete) The transitions seem to work fine, as well as the ability to control joints returned by getMS3DJointNode/getXJointNode/getB3DJointNode (NOT included in this patch) I’ll try and release this soon


Night.
Last edited by Luke on Wed Aug 16, 2006 2:48 pm, edited 1 time in total.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Aaaaaaaaaaaaaaaaaah! great! :D

Thanks Luke. Testing it right now.
Post Reply