# How do I implement camera axis aligned billboards?

I am trying to make an axis-aligned billboard with Pyglet. I have looked at several tutorials, but they only show me how to get the up, right, and look vectors. So far this is what I have:

target = cam.pos
look = norm(target - billboard.pos)

right = norm(Vector3(0,1,0) * look)
up = look * right

gluLookAt(
look.x, look.y, look.z,
self.pos.x, self.pos.y, self.pos.z,
up.x, up.y, up.z
)


This does nothing for me visibly. Any idea what I'm doing wrong?

## 1 Answer

I tried out billboards a while back. I just created a quad that faced the camera. Using the position I want the object at and the up and right vectors (normalized) of the camera, you can set the four corners of the quad like so:

a = position - ((right + up) * scale);
b = position + ((right - up) * scale);
c = position + ((right + up) * scale);
d = position - ((right - up) * scale);


Where a, b, c and d define the corners, use them clockwise or counter-clockwise depending on the winding order of your graphics library.

The right can be derived from the cross product or the look and the up vectors.

• this is how I've done it as well, you might want to add that you can derive 'right' based on the cross product of the camera direction versus "true up", etc. – Jimmy Sep 12 '12 at 17:19