How to import an .fbx asset with the correct world matrix?

Hi guys,

I would like to understand how to import assets in playcanvas.

My goal is to have a world scale unit equivalence beetween Houdini / Maya / Playcanvas.

In other word if:

  • i create a cube in houdini with translate / rotate / scale and export cube.fbx.
  • i would like to import cube.fbx inside Maya and Playcanvas and keep the exact same world unit.

In the same way i would like to be sure that dynamics scale unit will be interpreted with the same scale:

  • 1 unit = 1 metter / 1 mass unit = 1 kg in houdini
  • 1 unit = 1 metter / 1 mass unit = 1 kg in maya
  • 1 unit = 1 metter / 1 mass unit = 1 kg in playcanvas

In other i want to keep a logical world with clean / accurate transform in each of my apps.

From what i have see Playcanvas does understand 1 unit as 1 metter so that’s perfect.

The problem is that when i import an asset in Playcanvas. The world matrix is erase and i lost consistency beetween Houdini and Playcanvas.

Here are a description of the problem :

So i would like to know what is the clean workflow to import asset in Playcanvas with their correct transform ?
I haven’t find so much info in the doc :
http://developer.playcanvas.com/en/user-manual/assets/models/building/
http://developer.playcanvas.com/en/user-manual/assets/models/exporting/

Thanks for your help !

Cheers
Emmanuel

when i look at the generated .json file the correct transform are still there

    "name":"box_object1",
    "position":[  
       -2,
       1,
       0
    ],
    "rotation":[  
       45,
       24,
       0
    ],
    "scale":[  
       2,
       1,
       1
    ] 

when i download the store fbx file and reopen it the transform are correct.
so the question is more how to extract those info and set them in the entity transform by default instead of having t :0 0 0 / r :0 0 0 / s :1 1 1 ?

Have you looked at vertex buffer, the positions might be modified during export, making them very small numbers that leads to this?
Have you looked at exporting dialog, if there are any settings to affect this?

Edit:
Actually, sorry missed one thing: you are highlighting “Mesh” in houdini and maya, but in playcanvas you’ve selected actually an entity - which essentially is root node of that model, which always will be at 0,0,0. This node has child that is your mesh, and that child will have same matrix as you need.
Confusion here is that child nodes are not exposed within the hierarchy in playcanvas tree. This is something we will be working in the future.

Thanks you for your answer Max ! :slight_smile:

well if i understand correctly in playcanvas you have.

  • a transform node that represent the world matrix of an entity ( the root node )
  • a shape node that contain the object itself , in other word the vertex position of the object in object space

whatever you do if you upload an asset into play canvas the following rules apply:

  • your object will be parented to a root node and whatever you do the coord will always be:
    t:000 r:000 s:111
  • the info of the transformation node of your 3d software (maya / houdini) will be omitted and remain silent in the json
  • playcanvas will use the vertex position in object space to create the object

So after some few test i suceed to make the equivalence beetween houdini / playcanvas.

  • as playcanvas doesn’t use transform info all transformation must be done in the shape node itself

when we open the fbx we can see that there are no transform and only vertex position:

when we load this in playcanvas we can see that all the vertex position are correct:

but for an obscur reason playcanvas apply a scale of 0.01 to the entity node ?

so to counterbalance that when you export from houdini you have *to set a scale at 100 in SOP level ( shape object ) to make it work. and with this you have a perfect match beetween houdini and playcanvas world:

Max do you know why you apply this * 0.01 factor and how we can disable it to avoid the extra step ?

Cheers
E

That sounds like you are exporting into Centimeters. I can’t remember exactly, but I think there are settings in both the Maya settings panel and the FBX export options which determine the units used. It’s worth checking they are both correct.

When fbx is converted we extract this information:

  1. Vertex buffer.
  2. Index buffers (can be multiple), those are “Mesh”
  3. Nodes - those are transformation (matrix) objects. And they are hierarchical.
  4. Mesh Instances - those relate Nodes and Meshes in one object and material.

So each model inside can have many nodes (hierarchy, same as normal hierarchy), and mesh instances, and those mesh instances can in fact reuse same index buffer (if you use “clones” of meshes around within model).

In your simple example there is only one extra node - your cube. There will be always RootNode, which is basically origin of your scene in Maya.

The working units are here:

Looks like they default to centimeters, so yeah, you’d need to change this to meters.

Many thanks for the very detail infos guys ! I Will double check for the cm problem.