B3D support

Blitz3D Forums/Blitz3D Programming/B3D support

Code_666(Posted 2003) [#1]
OK, I recognise the need for the B3D file format and I do like it's structure. However many programmers, including myself, simply do not have the time to write code to exploit every new format that appears on the block. For the B3D format to really take off, we are going to need proper Blitz support. That is, a function that will save a mesh out (textures as well as bone segments, etc)... as opposed to the current offering of a simple untextured object. The code to do this is not too difficult but I resent having to code for a format that it's creators should really have made the effort to push harder.

The specification seems OK, but is somewhat incomplete in parts and I would just like a proper load and save function (or code for such functions) to appear in Blitz.
It would be useful to save out an object at runtime after manipulation.

The format cannot gain maximum exposure without the proper support a full API would garner.

This is not a criticism of the format or its creators, just a coder recognising the need for a weakness in a feature that needs to be addressed to gain a broader audience.

We need proper load and save functions, which would also enable simple editors to be constructed that are consistent as there appears to be some ambiguity over the format's implementation at the moment. By releasing standard code, then non-standard interpretations of the format can be avoided.


Stickman(Posted 2003) [#2]
Lets keep it simple for now,

I would like to see what the B3D file format supports first.

Working with it is both fun and frustrating at times but my biggest trouble is Im not sure if what Im attemting to do and the results are my own errors or somthing that is not supported by the B3D format itself.

For instance,I thought B3D format supported Multi surface Boned mesh files and as far as I can tell it don't.

How do I know ............I don't.

Its just that I loaded all the vertex and triangle info for a boned mesh with multi sufaces(brushes) and when I loaded the mesh and animated it,I got some really weird results.....like everything loaded but the bones couldent tell what surface they belonged to.

As a last note,I do feel that a file format that we can create and do as we please is very flexible and a must for game creation.I do support the B3D format,just wish I knew more about it and its support.


jfk EO-11110(Posted 2003) [#3]
AFAIK it DOES support multisurface boned animation. Have a look at the Stasi Guard I used in Operation Chateau Pregny (CSP Engine Demo 0.8, download at my site), he has 2 Surfaces: Body is one Texture and Head is an other Texture.
They share the same skeleton.

That Mesh was saved using CharacterFX. Peronally I am not very fit with the B3D Level Format and I totally agree with both of you in the fact that we need a FULL Documentation of it's Features, especially the Bones Chapter. I have no Idea where I could get some infos about that.

If you wonder about simpler usage, I have made a little B3D Saver, it can save lightmapped static Single Mesh Multi-Surface Geometry. Well, I used it to "patch" a Maplet Model that was kinda messed up in Decorator.

It is one of the first examples on how to use the new "Trackdown-Texturepaths" Functions to save a mesh that was loaded using Loadmesh including Textures. Tho, requires V. 1.85.

The Source is here:
http://www.blitzbasic.com/Community/posts.php?topic=26970


(tu) sinu(Posted 2003) [#4]
all my models using the b3d format are multisurface, , some have 3 different textures, or even more than one part and all animated using bones.

ps if thats what you meant.


Stickman(Posted 2003) [#5]
Thanks,
I didn't knoe that B3D file format supported Both multisurfaces and boned animations,now that I do I can work on getting them to work for my converter.

JFK,
I support you fully on the part about bones.
When I started my .X to B3D file converter I got Meshes, multi sufaces,and hierarchy Object animations working in the first day or so.
Been trying to get the bone stuff working wright for almost 2 weeks now and I still don't feel I got it.
Its just a subject that could use more explaning.


Stickman(Posted 2003) [#6]
About 2 hrs ago I didn't know that B3D supported Multi surface Boned animations.

Now 2 hrs later I now have multisurface boned animations working.

Its not that I coulden't do it,I didn't know it was supported.

I thought B3D was a take off of a MD2 style model formate.

I asked this ? before,if anybody knows the answer a YES\NO would be good enoff.

Can you save a pivot node before you start saving the mesh node and all of its bone nodes first in the B3D file.So you can rotate and position the mesh ( using the pivot node )?

At curent Im starting my B3D file with the Mesh Node ( the one with all the vertex and triangle info )

Thanks.....


Rob(Posted 2003) [#7]
Yes you can nest things. A b3d file can have many depths. See sdk/specs link above.


Koriolis(Posted 2003) [#8]
OT: code_666, didn't you received my e-mail? I've replied you by mail, I also did it on the bc forums, and no feedback. Still alive?


Stickman(Posted 2003) [#9]
Rob'
excuse me if I may seem sarcastic here, IM just Frustrated and confused.

OK, Your saying that a B3D file can have a Null Node (speak a pivot) created in the B3D File hierarchy before the mesh Node when saving a Boned animated mesh file.
This way when you use LOAD ANIM MESH() then ANIMATE() the mesh, this will start animating the mesh just like it would if it were a standerd .X file hierarchy animated mesh or Md2 or 3DS file.
How.......

I loaded JFK's Stasi_Run.b3d model and noticed he also dose not have a Null Node created prior to the Mesh Node, witch means to move this model you would have to create a Pivot prior to loading the mesh and attach this to the mesh Manually in blitz in order to position and rotate the entity without disturbing the mesh or bones themselves.

If this is true Do you have a model w\ bones and animations that this has been done that you would be willing to Email me in B3D file format to show how you did it. This way I can use Dump B3D to dissect the hierarchy structure and maybe figure out how its done.

I would really appreciate it if you or somebody else could help here.

Like I said I don't want to sound sarcastic IM just getting fed up with this.


Ricky Smith(Posted 2003) [#10]

you would have to create a Pivot prior to loading the mesh and attach this to the mesh Manually in blitz in order to position and rotate the entity without disturbing the mesh or bones themselves.


I may not be understanding exactly what you are trying to achieve but surely you can position the mesh manually in blitz by just operating on the mesh entity. All the bones and animation keys use local coordinates and so would be unaffected by any modification of the mesh's (root node) position ,scale or rotation.


jfk EO-11110(Posted 2003) [#11]
Stickman - correct me if I am wrong, but I think the Top Parent Pivot is generated automatcly with every Mesh that is loaded using LoadAnimMesh. You can easily test it with the new EntityClass$( entity ) Function, or simply try EntityAlpha on the first handle and see if it's gonna produce an error (when it's a pivot).

Not shure if this is what you need.


Stickman(Posted 2003) [#12]
Smiff,
Yes this would be true If there are no RootNode animation Keys Present.

JFK,
I thought so to,but this dose not seem to be the case when loading a B3D file,only .X / .3DS / MD2 files.Feel free to prove me wrong as for I would be tickled pink If I were ,but whats there to get wrong with.....

MyMesh=LoadAnimMesh("Bla.b3d")
Translateentity MyMesh,-90,180,0 ;standerd .x translation
Animate MyMesh

If this is done with a Model that has RootNode animations,as soon as the first keyframe for RootNode is called the Model will reset itself,Basickly the root node gets its Local coords from world as for there is no Pivot present for it to get its local coords from.

Im going to see if I can get a model to share to ya from here,first need to find a web site to share from.The results are going to blow your mind,as for there is more going on here then I wish to explain.

But Please feel free to keep responding untill so.


Stickman(Posted 2003) [#13]
Here is a demo (Scorce and B3D models) to help demonstrate what Im talking about.There are two models included ,one with rootGroup animations one with out rootGroup animations.
I have seen some of your demos Rob,Smiff,JFK,Im sure you can can figure the rest out.


jfk EO-11110(Posted 2003) [#14]
Unfortunately I cannot test it right now, surfin with an old notebook that doesn't support 3D :)

But now that you say it: yes, I think I remember that's true, animated B3D is a Mesh in the Top Entity, and 3ds etc is not. This is why I had serious troubles cause I wanted my Engine to be able to handle both, 3ds/x and b3d Enemy Chars. I used toe File Extension to seperate them, but that is only an emergency solution. Of course I will use the new EntityClass$() Function in upcoming Versions.

Stickman: couldn't you (just to make it easier for you) check if the Top Entity is a Pivot or a Mesh right after Loading? And if it's a Mesh, then just assign this Mesh Entity to a Pivot you can create on the fly? Ok, maybe I didn't understand what the goal is.


Ricky Smith(Posted 2003) [#15]
having a look.............


Ricky Smith(Posted 2003) [#16]
Had a good look at your models. I'll just give you my analysis of the .b3d file

What we have is a mix of hierarchial mesh animation and skeletal animation in one file - and it works !! However with unexpected results because the mesh animation is being carried out on the mesh node which represents the entity itself.

The model with the "root animation" has animation keys in the MESH node. As the mesh node has no parent these animation key coordinates are equivalent to world space and so the mesh is constantly positioned in world space during the animation - you are positioning the entire Mesh - not a joint - this node has no joint. This is why it wont rotate when animating (as you already know).
To resolve this you need to remove the Animation Keys from the Mesh Node and create a child node (joint) to contain the animation.The child node will be at exactly the same position, scale and rotation as the mesh node (usually 0,0,0)
A node can be either a "Mesh" node OR a "Bone" node but not both. You can have animation keys in a Mesh node but then its hierarchial mesh animation - not advisable to do this on the root node if you want to transform the model programatically later. Your transforms will be overwritten by the mesh node's animation keys.

So to answer your question about placing a root node in front - it will probably make no difference if your mesh node has animation keys - It would be better to remove the animation data from the root node entirely placing a node after the mesh node as a child containing the bone,weights and animation keys - seperate from the mesh.

Cheers
Smiff


Ricky Smith(Posted 2003) [#17]
I just had another look at your model with the root mesh animation and ran it through an export routine that exports the model with bone animation data only - basically stripping out the mesh animation data. The model now animates ok and is transformable when animating - All of the vertex are assigned to joints so the mesh animation is not needed.
By putting animation keys on the entire mesh you are 'hard-coding' the entity's position,scale and rotation.


Stickman(Posted 2003) [#18]
JFK,
Yes that is what IM currently doing, and was attempting to try to avoid.

Smiff,
I understand your fix and pretty sure I can get it to work.

As a last note....
The way the B3D files I sent use a mesh for root group animations is how 3D Canvas is saving to the Direct X format and not of my own choosing. 3D Canvas gives you a choice to save root Group animations or not to, and its advised from canvas if your not sure to click yes.

With That in mind.......

I would just like to say thanks, as for IM sure the many 3D Canvas users who might be using my latest version of "STK. DX8 to B3D file Converter"( due to be released in a couple of weeks) will appreciate the effort taken to help simplify the steps in converting models from 3D Canvas to B3D format.

As for many users of both Blitz and Canvas (especially newbies) my become confused with models that would have been loaded in they way the "root animation " file was.

I know I was at first and IM the one who created the converter to convert the file.

Thanks again I really appreciated your efforts and help.

P.S If anybody else has any other ideas,Please post, as for Ill be very interested to see them.....