Sign in to follow this  

how to start with geometry shader (in cg) ?

This topic is 1702 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

hello,

I have a lot of trouble to learn geometry shader, I work in cg and i haven't find any tutorial or usefull documentation about it.

from now i have read the nvdia's book: http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter01.html, and implemented sucessfully nice looking lightning (with normal map, specular map, etc) and some animation.

 

but for geometry i only found some sample from nvida not commented and in ASM and some article about the concept and the purpose of it.

 

it took me a day to actually get a working simple pass through hello world:

 

 

TRIANGLE
void mainG(AttribArray<float4> position : POSITION)
{   
emitVertex(position[0] : POSITION, float4(1,0,0,1) : COLOR);
emitVertex(position[1] : POSITION, float4(0,1,0,1) : COLOR);
emitVertex(position[2] : POSITION, float4(0,0,1,1) : COLOR);
}
 

 

do you guys know any good reference that google don't ?

 

Share this post


Link to post
Share on other sites

no very detailed code examples, but nevertheless, I wrote about it a long time ago (using Cg) so maybe this is useful:

http://tower22.blogspot.nl/2011/01/mega-structures-geometry-shaders-1.html?q=geometry+shader

http://tower22.blogspot.nl/2011/02/mega-structures-geometry-shaders-2.html?q=geometry+shader

http://tower22.blogspot.nl/2012/05/making-off-radar-demo-8-morphing.html?q=geometry+shader

 

and maybe it appears on a few more places. The boxes with code examples almost got unreadable after Blogger suddenly changed the lay-out but it shows various shaders anyway

Share this post


Link to post
Share on other sites

thanks for your blog, I learned some stuff about GS, but it's a shame some functions like "rerestartStrip()" or just "emitVertex()", are defined nowhere on the nvidia's doc which seems actually only composed of gp4gp information and this unreadable ugly thing, I had to find these functions in random forum's code and figure out what they may do.

since my first post I started to learn glsl instead which is well documented and a lot more used, I'll maybe switch back to CG once i'm comfortable with shaders.

 

ps: I also learned a lot about deferred rendering on your blog and bookmarked it ;)

Share this post


Link to post
Share on other sites

This topic is 1702 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this