Some basic <node> questions about translate and rotate

Hey All,

I’m having to hand write an importer, which is coming along pretty well, but, am having trouble understanding how some of the parameters work together in the <node> blocks.

So, basically, I imported an FBX file for reference that loads in correctly…

FBX values:

The “Light” is at:

Translation: 0, 0.3048, 0.1969008
Rotation: 0, 0, 0

The “spotLight” is at:

Translation: -0.336533, 1.624422, 0.7187547
Rotation (Euler): 60.59999, 344.8, 0

So, how does 0, 15.2, -29.4 in the spotLight’s rotation ultimately translate to 60.6, 344.8, 0. I’m 99.9% sure that it has something to do with the “rotatePivot”, “rotatePivotInverse”, “scalePivot”, and “scalePivotInverse”. I’m just not sure how these work, and I don’t see any documentation for them in the 1.4.1 spec PDF.

The unitScale parameter is: 0.3048

    <visual_scene id="VisualSceneNode" name="Scene01">
      <node id="Lights" name="Lights" type="NODE">
        <translate sid="rotatePivot">0 1 0.646</translate>
        <rotate sid="rotateZ">0 0 1 0</rotate>
        <rotate sid="rotateY">0 1 0 0</rotate>
        <rotate sid="rotateX">1 0 0 0</rotate>
        <translate sid="rotatePivotInverse">0 -1 -0.646</translate>
        <translate sid="scalePivot">0 1 0.646</translate>
        <translate sid="scalePivotInverse">0 -1 -0.646</translate>
        <node id="spotLight1" name="spotLight1" type="NODE">
          <translate sid="translate">1.10411 6.32947 3.00412</translate>
          <rotate sid="rotateZ">0 0 1 0</rotate>
          <rotate sid="rotateY">0 1 0 15.2</rotate>
          <rotate sid="rotateX">1 0 0 -29.4</rotate>
          <scale sid="scale">9.19261 9.19261 9.19261</scale>
          <instance_light url="#spotLightShape1-lib"/>

Thanks a lot for any help, :smiley:

Does anybody know what “rotatePivot”, “rotatePivotInverse”, “scalePivot”, and “scalePivotInverse” do?


First up the reason that you cannot see any of these quoted values in the specification is (so I understand) because the ‘sid’ attribute can vary. You should look at Section 3-3 of the COLLADA 1.5 specification as I know little about this at the moment.

All they do is apply a 3d translation to a node though. They’re generated by your exporter. I’d assume that you have a pivot point specified in your modelling environment that is causing your exporter to do this.

Back to your first post though, I’m just guessing, as I don’t quite follow you, but are you applying each of these matrix transformations in order to your modelview matrix?

The other point to make would be to check you have applied the transforms in the correct order. (I’ve put this in bold because I made this mistake, lost an hour over it.)

On an side note, interestingly, I notice your exporter is providing unrequired translations:

<translate sid="scalePivot">0 1 0.646</translate> 
<translate sid="scalePivotInverse">0 -1 -0.646</translate> 

All the best with your project,

Collada does not differentiate between Pivot or non-Pivot.
Sid is like a secondary id, used by animation as channel target.

Adam is right, Sid is optional, and the order of the transform is VERY important, since those transform matrices are not commutative.

Some exporters might be not work correctly or give verbose information.

Your code snippet looks weird. The exporter might not export correctly. I would suggest you to start working on your importer from some existing collada files from the internet ( or hand-write some simple transform for now.

These rotates are rotating 0 degree, not effecting the the actual transform.
<rotate sid=“rotateZ”>0 0 1 0</rotate>
<rotate sid=“rotateY”>0 1 0 0</rotate>
<rotate sid=“rotateX”>1 0 0 0</rotate>
However, if there are animation targeting these values, then these rotate elements must be present.

If I understand your expected transforms values of your two light, their transform should look like this.
<node id=“LightShape1”>
<translate>0 0.3048 0.1969008</translate>
<rotate>1 0 0 0</rotate>
<rotate>0 1 0 0</rotate>
<rotate>0 0 1 0</rotate>
<instance_light url="#LightShape1-lib"/>
<node id=“spotLight1”>
<translate>-0.336533 1.624422 0.7187547 </translate>
<rotate>1 0 0 60.59999</rotate>
<rotate>0 1 0 344.8</rotate>
<rotate>0 0 1 0</rotate>
<instance_light url="#spotLightShape1-lib"/>

Hope these information can help you,