[DX11] Geometry Shader / Vertex Shader

Started by
3 comments, last by Martin Perry 11 years, 9 months ago
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 ?
Advertisement
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.
So just generate for example one triangle with all vertices "0" ?
Do you have two points per line, or is it variable?
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 :))

This topic is closed to new replies.

Advertisement