Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualTiagoCosta

Posted 11 July 2012 - 02:37 AM

The output of a geometry shader is usually a triangle strip. You can use RestartStrip() to simulate triangle lists by calling RestartStrip() after appending each 3 vertices.
So if your example is working that's because you're correctly outputting triangle strips so there is no need to use RestartStrip() more than you do.

Another approach you could use is to just output 2 quads (4 triangles) one of them a little bigger than the other (to create the border) and add an attribute to the vertices so in the pixel shader you know if you're drawing the border and output a different color.

One improvement to do in my example would be to output the smaller quad first, so hopefully (I'm not sure if the first triangles will be drawn first but maybe someone else does, or you can simply test) when the second quad is drawn the early depth test will reject the pixels of the smaller quad and no overdraw occurs.

#2TiagoCosta

Posted 11 July 2012 - 02:36 AM

The output of a geometry shader is usually a triangle strip. You can use RestartStrip() to simulate triangle lists by calling RestartStrip() after appending each 3 vertices.
So if your example is working that's because you're correctly outputting triangle strips so there is no need to use RestartStrip() more than you do.

Another approach you could use is to just output 2 quads (4 triangles) one of them a little bigger than and behind the other (to create the border) and add an attribute to the vertices so in the pixel shader you know if you're drawing the border and output a different color.

One improvement to do in my example would be to output the smaller quad first, so hopefully (I'm not sure if the first triangles will be drawn first but maybe someone else does, or you can simply test) when the second quad is drawn the early depth test will reject the pixels of the smaller quad and no overdraw occurs.

#1TiagoCosta

Posted 11 July 2012 - 02:34 AM

The output of a geometry shader is usually a triangle strip. You can use RestartStrip() to simulate triangle lists by calling RestartStrip() after appending each 3 vertices.
So if your example is working that's because you're correctly outputting triangle strips so there is no need to use RestartStrip() more than you do.

Another approach you could use is to just output 2 quads (4 triangles) one of them a little bigger than the other (to create the border) and add an attribute to the vertices so in the pixel shader you know if you're drawing the border and output a different color.

One improvement to do in my example would be to output the smaller quad first, so hopefully (I'm not sure about this but maybe someone else does) when the second quad is drawn the early depth test will reject the pixels of the smaller quad and no overdraw occurs.

PARTNERS