DEV Community

loading...

Billboarding in Geometry Shaders

the_wooden_h profile image Wooden H Studio ・1 min read

Backface Culling

In DirectX, backface culling is on by default which makes dealing with flat objects more difficult. If the flat object is facing the wrong direction, then the object will not be rendered. This is especially a problem when trying to make use of geometry shaders for particles. For the particles, I decided it would be best just to put in a point and append triangles to it to create a quad. If the quad created with the appended triangles did not face towards the camera it would have been culled.

Billboarding

A solution to flat objects not facing the camera is to have them always face the camera. To have the flat objects always face towards the camera I implemented billboarding in the geometry shader. Billboarding does not necessarily have to be done in the geometry shader, it could be done in the vertex shader but if that vertex also goes through a geometry shader the orientation of the added geometry won’t necessarily be facing the direction you want it to. If the billboarding was done correctly in the geometry shader the object should always be facing towards the camera.

By Taylor Addington

Discussion (0)

Forem Open with the Forem app