# Billboard rendering without distortion?

I use the standard approach to billboarding within Unity that is OK, but not ideal:

transform.LookAt(camera)

The problem is that this introduces distortion toward the edges of the viewport, especially as the field of view angle grows larger. This is unlike the perfect billboarding you'd see in eg. Doom when seeing an enemy from any angle and irrespective of where they are located in screen space.

Obviously, there are ways to blit an image directly to the viewport, centred around a single vertex, but I'm not hot on shaders.

Does anyone have any samples of this approach (GLSL if possible), or any suggestions as to why it isn't typically done this way (vs. the aforementioned quad transformation method)?

EDIT: I was confused, thanks Nathan for the heads up. Of course, Causing the quads to look at the camera does not cause them to be parallel to the view plane -- which is what I need.

I'm confused by your question because in a standard perspective projection, drawing a billboard parallel to the view plane does not introduce distortion. It's equivalent to blitting the image to the viewport with some scaling, where the scaling depends on depth (perpendicular distance from the view plane).

The "distortion" you're seeing might happen if the system is actually orienting particles to face the camera rather than the view plane; that causes skewing near the screen edges. Or, you might be seeing that the sprite's scale changes as you rotate the camera, since when distance is measured to the view plane rather than to the camera, the sprite gets "closer" and hence bigger as it goes offscreen.

• @NickWiggill I'm not familiar with Unity specifically, but if you want to have the quads face the view plane rather than facing the camera, you essentially set the quad's rotation matrix equal to the camera's rotation matrix. You might need an extra 180 degree rotation in there depending on how the quads are constructed. Commented Apr 12, 2012 at 22:28

I believe you can set the top 3x3 matrix (in column-major speak) to the identity to do this. I don't see any reason why you couldn't do this in the shader, but you might be doing more work that way. You'd lose scale (in your xformation matrix) this way.