0
votes

I have a billboard deep inside a 3D scene node hierarchy. The billboard inherits all 3D transformations applied to parent nodes.

I want the billboard to always "face the camera" (= have a zero derived rotation vector). The problem is that its derived matrix is read-only so I can't manipulate it directly to nullify rotation (as proposed in another case).

What I can do is manipulate its local matrix so that the final derived matrix meets my requirements.

Is there a formula to achieve this?

1
You want to invert a 4x4 matrix?Beta
No, let me rephrase : I have a 4x4 derived transformation matrix of a 3D node. I need to find a way to change the node's LOCAL transformation matrix so that the new resulted derived matrix will have zero rotations.Bill Kotsias
You have a 4x4 matrix, call it A. And you want to find a find another 4x4 matrix, call it B, such that A * B = I, the identity matrix?Beta
@Beta : Heh, no. A 4x4 transformation matrix is "composed" of 3 "parts" : rotational, translation and scaling. I want to nullify the rotational part while maintaining the other 2 intact.Bill Kotsias
So the problem is to derive the rotational part?Beta

1 Answers

0
votes

As long as you don't use the homogeneous portion of the matrix, you can always do this.

A*B + B*A = C, where B = {0,0,0,0;0,0,0,0;0,0,0,0;0,0,0,1}

This should give you C = {0,0,0,s; 0,0,0,s; 0,0,0,s; x,y,z,2*w} where s is a scaling value and this is column oriented, meaning {1,2,3,4; 1,2,3,4} would be 4x2 matrix (4 rows two columns).

Hope this helps.