Jump to content
  • Advertisement
Sign in to follow this  
Martin Perry

DX11 [DX11] Geometry Shader / Vertex Shader

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

I am trying to generate "bold" line... I have points creating a single line. My idea is to send those points via StructuredBuffer<float2> to GS and there "cook" triangles by calculating displaced vertices from line points
So far I have this done in pixel shader... i send line in structured buffer and than generate triangles and apply "point-in-triangle" test for every "screen-pixel" (i need only 2D case). It works nice... but performnace is of course poor (the longer line is, the slowest it is :))

Idea is to generate triangles in GS and send them to PS. But VS is kind of obsolete... I dont need any output from it... and i dont even have any geometry to send in... how to handle this ?

I know, I can attach NULL vertex buffer and use SV_VertexID... but problem is still the same... i dont have any triangles yet, only line points. I can generate triangles in VS via this, with some "magic" if-ing (can generate only 1-triangle at time, not all of them at once like in GS).
What is better solution and how can it be done with only GS ?

Share this post


Link to post
Share on other sites
Advertisement
Do you have two points per line, or is it variable?

Share this post


Link to post
Share on other sites
I have two points per line and "normal" vector at those points... I move [x1,y1] and [x2,y2] by +/- [z1,w1] and +/- [z2,w2] to get 4-vertices polygon (2 triangles respectively). I changed points every frame, as the line tracks movement (like trail behind snail :))

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!