Easy to do Geometry Shader Example

Started by
2 comments, last by MJP 12 years, 11 months ago
hello,
i'm starting to learn geometry shaders using CG.

i am looking for a fun and easy to do example or tutorial. something where you can have a "reasonable" result at the end and not just some randomly floating triangles.

does anyone have any ideas on what to do which is not too hard for a beginner?

thanks!
Advertisement
I don't know of any Cg tutorials, but one of the simplest and most useful things you can do with a geometry shader is expand a single point into a quad. Very handy for particle system rendering. Basically you transform the point to view space in the vertex shader, then in the geometry shader you billboard in view space so that you can emit 4 new vertices forming a 2-triangle strip.

I don't know of any Cg tutorials, but one of the simplest and most useful things you can do with a geometry shader is expand a single point into a quad. Very handy for particle system rendering. Basically you transform the point to view space in the vertex shader, then in the geometry shader you billboard in view space so that you can emit 4 new vertices forming a 2-triangle strip.


thanks for the tip! sounds good! do you maybe have any sample code for that? if not in CG, GLSL or HLSL is ok too.
The only one I know off the top of my head is the SoftParticles sample that ships with the DX SDK.

This topic is closed to new replies.

Advertisement