# 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?

• gluLookAt defines where your camera is looking at, not where the object is facing. Commented Sep 12, 2012 at 17:15
• Typically, when one says "axis aligned", they are referring to the global axis. I know that you mean the axis of the camera, but it'll be good to know for future reference. Commented Sep 12, 2012 at 17:37
• Viewpoint oriented version: gamedev.stackexchange.com/questions/5959/… Commented Apr 12, 2016 at 9:05
• stackoverflow.com/questions/5467218/opengl-2d-hud-over-3d Commented Apr 12, 2016 at 10:53

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. Commented Sep 12, 2012 at 17:19