View Full Version : Billboarding

01-03-2012, 05:53 AM

I am trying to get billboarding to work. I needed a little clarification. This is the way i tried:

From the modelview, i obtain the following:

-- --
| x1 y1 z1 -|
| x2 y2 z2 -|
| x3 y3 z3 -|
| - - - -|
-- --

[(x1, x2, x3) is the vector that provides the X orientation]
[ ** '-' implies i'm not using that part of the matrix]

Using the x vector, find the angle between that and
[0, 0, -1] So, this would be the angle i need to rotate the billboard on the y axis.

Let this angle be "Ang"

So, what i'm trying is:

1) Rotate scene by "rot" angle on the Y axis.

2) Using the modelview, obtain "Ang" Now, rot will be equal to Ang. So, i just do a negative rotation of Ang on the Y axis.


. Rotate scene by rot
. Obtain Ang
. Rotate object by -Ang

This seems to work. I am trying for billboarding on only one axis. Is there a better way? Or is this method fine?