Jump to content
  • Advertisement
Sign in to follow this  
8.zwerg

Unity FBX poses

This topic is 641 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi community,

Im writing a custom FBX importer for my programm (since the SDK by Autodesk is not usable for Pascal). Everything works quite fine instead of applying the Poses.

For my programm, I need to get the global coordinates of each Vertex, so what I do is:

 - Multiplying the pose's rotation matrix with each Vertex and add translocation

 

Unfortunately, as soon as I change the pose (eg in Blender) from (0,0,0) to anything else, the objects have a different position.

So I expect an error in my multiplication (Im getting valid floats in Pose matrix and Vertex), but I dont see any error here.

a1 a2 a3 tx
b1 b2 b3 ty
c1 c2 c3 tz
0  0  0  1

newX:=a1*OldX+a2*OldY+a3*OldZ+tx;
newY:=b1*OldX+b2*OldY+b3*OldZ+ty;
newZ:=c1*OldX+c2*OldY+c3*OldZ+tz;

By the way:

Am I in need of using the poses even if Im not using animation?

What exactly is the difference between "Blind Poses" and the Objects "Properties" for scale,rot and pos?

Share this post


Link to post
Share on other sites
Advertisement
since the SDK by Autodesk is not usable for Pascal

A compiler and import code that both support extern C (or similar) calls might work.

 

 

I need to get the global coordinates of each Vertex, so what I do is:

depends on what you're working with, and what you're trying to achieve. if you have a rigged skinned mesh, it can be posed in pose mode in blender, then exported.  This creates a static mesh, like a statue. You'll have to look up how to apply the pose during the export.

If you have a mesh that is not rigged, its just a statue, like any other mesh. Edit it to the pose you want (in edit mode), then export.  

Note that in object mode, you want scale=1, location =0,0,0,  rotation =0,0,0.  then adjust things in edit mode so they line up.

If you're not animating, you're either doing rendered sprites, or 3d statues.  

for rendered sprites, you render a 2d image from which you then make a sprite. but you need multiple sprites for different viewing angles, and the sprites won't respond to lighting.  

a statue is just another mesh that happens to look like a person. applying scale, rot, translate to every vert will move the whole thing like a statue.  These are probably the results you are seeing now.

to move limbs individually, there are two ways to go about it:

1. use a rigged skinned mesh, and capture your poses as animation frames. then set the animation controller timer to the frame / pose you want before you draw. probably loads faster, should use less ram, is more complex to implement

2. export a copy of the mesh in each pose desired, and simply draw the appropriate mesh depending on the pose desired.  probably loads slower, should use more ram, is less complex to implement.

 

What exactly is the difference between "Blind Poses" and the Objects "Properties" for scale,rot and pos?

Do you mean "bind pose" ?    The bind pose is the pose used to rig the mesh, typically a "T" or "A" pose for a humanoid.  Its the pose you put the mesh into before you "bind" the vertices to the bones (IE rig - assign weights).

The object properties for scale, rot, trans are its transform relative to object / local space.  

always keep object scale at 1, and trans and rot at 0.  that way your object is centered on the origin in object space, with a scale of 1 and no rotation, before you apply the world transform in your game.  

Any adjustments to object scale, rot, or trans should be made in edit mode, not object mode.  

Use object mode to move objects out of the way temporarily when editing multiple objects in a single scene, or to arrange objects into models such as quad based plants before you join/merge them to become a single object.

When exporting a single object, always make sure to set the object back to scale= 1, rot=trans=0 before exporting.  if your object is one unit left of center in blender it will always draw one unit left of center in the game - not where you tell it to. same idea for scale and rotations. so always keep the object transform at identity, and edit the mesh, not the object.

 

Multiplying the pose's rotation matrix with each Vertex and add translocation   Unfortunately, as soon as I change the pose (eg in Blender) from (0,0,0) to anything else, the objects have a different position.
 

A mesh rigged with exactly one bone will have a single "pose" transform matrix. A mesh that is not rigged will not have any pose matrices. a skinned mesh will have a transform matrix for each bone.  all meshes also have an object transform matrix (the object's transform relative to the object space origin and axes).  to draw a posed statue  in the world with some rotation, simply apply the world transform mat  (scale,rot,translate) to the vert, and ignore the object matrix. if you factor out the object matrix, the object will start at the origin in object space with scale 1 and no rotation, all ready for the worldmat to be applied. 

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

The models I want to Import dont have any kind of animation.

 

When exporting a single object, always make sure to set the object back to scale= 1, rot=trans=0 before exporting.

 

I dont have a problem with that, becaused Im even used to that^^

But Im in need to expect that other users wont care about that, so thats why Im trying to apply the transformation.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!