Jump to content

  • Log In with Google      Sign In   
  • Create Account

[DX11] Geometry Shader / Vertex Shader


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Martin Perry   Members   -  Reputation: 1324

Like
0Likes
Like

Posted 07 July 2012 - 08:58 AM

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 ?

Sponsor:

#2 phantom   Moderators   -  Reputation: 7278

Like
0Likes
Like

Posted 07 July 2012 - 09:14 AM

You can't avoid having a vertex shader stage, so just make it 'pass through' and do the work in the GS as you plan.

#3 Martin Perry   Members   -  Reputation: 1324

Like
0Likes
Like

Posted 07 July 2012 - 09:21 AM

So just generate for example one triangle with all vertices "0" ?

#4 MJP   Moderators   -  Reputation: 11372

Like
0Likes
Like

Posted 07 July 2012 - 12:49 PM

Do you have two points per line, or is it variable?

#5 Martin Perry   Members   -  Reputation: 1324

Like
0Likes
Like

Posted 07 July 2012 - 01:48 PM

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 :))




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS