Collada Export and Actors

Post Reply
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Collada Export and Actors

Post by clintonman »

I discovered a bug when using the collada exporter with actors. From what I can tell the default pose of the actor does not export correctly. So you end up with a messed up result when opening in other software. It uses what's called an Inverse Bind Matrix to define the relationship between the bones and the vertices of the mesh.

One solution is to create skeletons where the joints all have zero rotations The inverse of zero rotation is just zero rotation, so the Inverse Bind Matrix is just filled with zero rotations.

I have a script that adjusts all the joints to have zero rotations. So it can be used to help create actors that can be exported properly.
http://clintons3d.com/plugins/truespace ... rient.html

I also had trouble with the glTF exporting actors because of bad bind matrix. makes me wonder if there is a flaw in the tS SDK math functions.

The FBX exporter will export a good bind matrix in it's files. It uses it's own internal fbx sdk functions to create the bind matrix.
This reminds me the fbx sdk can export collada, so should test and compare....

EDIT:

Confirmed. Imported glTF actor and exported it as collada via the FBX exporter and the result was good.
Clinton Reese

http://clintons3d.com
User avatar
trueBlue
Captain
Posts: 5216
Joined: 06 Jul 2009, 22:50
Type the number ten into the box: 10

Re: Collada Export and Actors

Post by trueBlue »

Trying to follow along so I can learn the Steps necessary to Export an Actor properly.
Would you mind using this Avatar - Female scene as a template for Exporting?
I think I have done everything needed for Export; except I have not tried using your Joint Orientation Helper for trueSpace7.61 script
Zero all Joints
Usage (zero all joints)
select an actor or a skeleton
make sure the default pose is set
press the Zero All Joints button
Avatar - Female scene
Scene Lights and EntryPoint camera converted to Material List
woman
Modifications:
Converted Head and Body to D3D Materials
Todo: Convert to Scene Instancing
Synchronized UV Coordinates - UV2
Disabled all Clips except Default to Idle
Add: Default to Idle Reversed clip
Todo: Zero all Joints?
Attachments
Avatar - Female.RsScn
(2.08 MiB) Downloaded 35 times
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Collada Export and Actors

Post by clintonman »

trueBlue wrote: 31 Oct 2023, 18:11 Trying to follow along so I can learn the Steps necessary to Export an Actor properly.
Would you mind using this Avatar - Female scene as a template for Exporting?
I think I have done everything needed for Export; except I have not tried using your Joint Orientation Helper for trueSpace7.61 script
Zero all Joints
Usage (zero all joints)
select an actor or a skeleton
make sure the default pose is set
press the Zero All Joints button
Avatar - Female scene
Scene Lights and EntryPoint camera converted to Material List
woman
Modifications:
Converted Head and Body to D3D Materials
Todo: Convert to Scene Instancing
Synchronized UV Coordinates - UV2
Disabled all Clips except Default to Idle
Add: Default to Idle Reversed clip
Todo: Zero all Joints?
Copy the woman
make the original invisible and work on the copy
remove all animations - zeroed joints can't use the same animation
Joint Orientation Helper doesn't work with ik handles or joints
remove all ikhandles
remove all iklocks
set default pose
attach skin to skeleton - select head and body to unskin them
Joint Orientation Control - zero all joints
set default pose
attach skin to skeleton - reattached head and body
set default pose
make the original woman visible again
select the working copy and start the "transfer skinning weights" tool
mapping set to uv2
click on the original to copy the weights
hand animate to match the original
export collada

my result: viewed in the fbx converter and the animation looks bad. maybe because the skeleton root has a large rotation value that does not get zeroed out

directly exported your woman and it works just fine as is without any changes. my theory is if it's created inside tS it will work because tS makes the joints z point down the bone. import actors the joint can be pointing in any direction. also been testing with blender and it may have an issue with some collada imports. import the original woman into blender at it looks terrible. import the zeroed out woman and it still looks bad but clearly better than before.
Guess more research is needed.

Takeaways: Sometimes it just works so first try to export as is. The Joint Orientation helper needs to be updated to work with ik handles and ik locks. It also needs to be updated to work with the skeleton root, so it can also be zeroed.
Clinton Reese

http://clintons3d.com
User avatar
clintonman
Captain
Posts: 5432
Joined: 21 May 2009, 21:08
Type the number ten into the box: 0
Location: California
Contact:

Re: Collada Export and Actors

Post by clintonman »

Did some testing and a lot of issues was from using Blender to import the tS exported collada. Blender does not like the collada coming from truespace. Even when those same files look good in other programs. I also believe that truespace is making some kind of assumption that the joint z direction runs down the bone chain. So zeroing out the rotations breaks the export. I was using the unfriendly blender import and that lead me to think that zeroing the joint rotations was helping, when in reality it was hurting the situation.

I also did some work on the Joint Orientation Tool and found it doesn't work when sibling joints have the same name. It needs a check and reporting for that limitation. It will now zero out the skeleton root and it wont fail when ik locks and ik handles are present. It still doesn't work right with ik handles, it just doesn't error out when it sees one. These changes wont help with collada to blender. It should help with gltf export.

The theories so far:

Don't export a trueSpace actor in collada format if transferring over to Blender.
It might be possible to export actors in collada format to blender via the fbx export plugin and scripts.
The Joint Orientation Tool needs fixing so it can help with actor exports in glTF format.
Clinton Reese

http://clintons3d.com
Post Reply