Fixing Billboarded Sprites Clipping into 3D Geometry

Having thought about it a little more, it seems there’s an even simpler solution, if the billboards are guaranteed to always face the camera, which I think they are.

For orthographic cameras the backwards leaning of the billboard is equivalent to a vertical stretch, nothing more should be happening. So you shouldn’t even need a back-leaning world matrix at all. Just use an upright matrix with the up vector scaled properly to account for this vertical stretch. Visually this should be indistinguishable from a backwards rotation.

I’m pretty sure the scale factor is simply 1/camUp.Y (assuming the camera doesn’t roll/bank), so if you just change this line in your code

constrainedBillboardWorld.Up = Vector3.Up;

to

constrainedBillboardWorld.Up = Vector3.Up / constrainedBillboardWorld.Up.Y;

and then use this matrix as your only world matrix for rendering, you should get the desired effect. At least in my brain it works perfectly, it is a little late though :slight_smile: