11

##### OpenGL / Re: Billboards - Best practices

« Last post by**KaiHH**on

*June 28, 2020, 13:57:31*»

This was not what I meant with the rectangle (from now on be simply called 'P') being perpendicular to the camera view direction or perpendicular to the camera near/flar plane's normal.

What you are talking about is basically having P's rotation constrained to the world's Y axis, but no rotation applied on the X or Z axes.

Or in other words: P will always "stand straight" in the world but will only rotate around the world's Y axis such that P's normal vector is collinear to the camera's view direction or the camera's near/far plane normal.

This can be achieved with:

R = P * V * M * (r(V)^-1)[col1 = (0, 1, 0, 0)]

where (X)[colN = V] is: X where the column with index N (0..3) is replaced by vector V.

This will constrain the rotation only around the Y axis.

So it's basically the same as the "always perpendicular to the camera's direction" but with the constraint of only allowing rotation around the Y axis of the object which is the additional operation on the inverse of r(V).

What you are talking about is basically having P's rotation constrained to the world's Y axis, but no rotation applied on the X or Z axes.

Or in other words: P will always "stand straight" in the world but will only rotate around the world's Y axis such that P's normal vector is collinear to the camera's view direction or the camera's near/far plane normal.

This can be achieved with:

R = P * V * M * (r(V)^-1)[col1 = (0, 1, 0, 0)]

where (X)[colN = V] is: X where the column with index N (0..3) is replaced by vector V.

This will constrain the rotation only around the Y axis.

So it's basically the same as the "always perpendicular to the camera's direction" but with the constraint of only allowing rotation around the Y axis of the object which is the additional operation on the inverse of r(V).