• Advertisement
Sign in to follow this  

Geometry Shader for a quad or not ?

This topic is 1340 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all,

I would add a Billboard component for Actor who is just a render of a quad with a texture oriented with the camera.

Is it better to send a point and generate the quad using geometry shader or directly send a static buffer + matrix ?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
If you want to draw multiple actors like that, in a single draw call, then you will probably store the per actor data (position, texture frame, ...) in the vertex buffer. In that case, if you provide the quads directly, you will have to duplicate that data 4 times.
Thus I would suggest either geometry shader (send points and expand them to quads) or instancing. Instancing a quad multiple times would give you the same end result, but be more flexible if you need more complicated shapes then quads in the future.

Share this post


Link to post
Share on other sites


Instancing a quad multiple times would give you the same end result, but be more flexible if you need more complicated shapes then quads in the future.

For purposes of flexibility, I would think rather the other way 'round. If you want the option of different (run-time selectable) billboard shapes, you can maintain just a point-list and a GS with routines for various shapes to be chosen by a flag. Seems that would be more efficient that changing the shape CPU-side.

Share this post


Link to post
Share on other sites

On my Intel HD Graphics 3000 thingy extracting quads from points is about twice as fast as instancing quads.

Share this post


Link to post
Share on other sites

It does depend heavily on HW. ATI gave a presentation at gdc this year that showed that on their hw using the GS was somewhat slower than calling DrawInstanced with 4 verts per quad and doing the work in the VS instead, whereas on recent NV hw it was pretty much the same.

Share this post


Link to post
Share on other sites

@mhagain - you make some excellent observations. Converting a pointlist to the desired billboard shape CPU-side once, rather than each render, may be a better option.

Share this post


Link to post
Share on other sites

@mhagain - you make some excellent observations. Converting a pointlist to the desired billboard shape CPU-side once, rather than each render, may be a better option.

 

I would say diifferent.  Unless the OP has some kind of weird pathological case, this is going to be down in the noise on any performance graph, no matter which is used.  As a general rule vertex submission for sprite quads is strictly in "don't sweat the small stuff" territory.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement