Geometry Shader Woes

So, generating lots of billboards and grass; Geometry Shader right ?

Depends on the GPU. I have a nice implementation of GS generated grass and billboards based on instanced GS from 2D points passed in a VB. Expansion of the points is done in two stages; by an instance buffer on the CPU giving the world location of a mesh of points, and then by tbe GPU GS instancing.

The results on a powerful GPU are good; less transfer of data to the GPU and substantially smaller models. Also the elimination of uneeded grass vertexes in the GS (depending on the result of a fractal noise calc) meant no need to pass in and eliminate degenerate triangles.

On a slightly lower spec card it tanked. Performance was aweful. Changing the code to a (much) larger model grass patch and passing it through a simple VS/PS shader was much faster by a factor of 4. There was a large number of degenerate triangles discarded between the VS and PS, which in the GS would never even have been generated, but still “the stopwatch never lies”.


2 thoughts on “Geometry Shader Woes

  1. Hi Phil, as you know this is my favourite blog. I feel indebted to point you to (probably my fave dev) whilst his work may hold no immediate answers (and is somewhat unity centric) browsing his corpus will likely spark a few ideas. Certainly holding across domains.

    Thanks for the continuing adventures.

    • Thanks TwoBob. I see the grass demo you are referencing, but I also see that it has a very short FOV and requires fogging to reduce the tri-count; something I’m trying to avoid. I’ll post some demo visuals soon on the grass effect I’ve achieved. Problem is density close-up is relatively easy to achieve, but blending with distance to give a nice fall-off effect is hard. I’m inspired by the Outerra team who have made this their mission, and I’m really just trying to work out how they do it; with the addition of beign completely runtime generated rather than sampling from geo-surveys.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s