Why is my geometric shader outputting four triangles instead of two?

  c++, directx-11, geometry-shader

Have I misunderstood how geometric shaders work?
When drawing two triangles by index buffers,
Draw Count
My geometric shader outputs 4 triangles.
Shader Input/Output
But my shader code restrics the [maxvertexcount] to 3.
Geometric Shader Code

From what I can see, the only thing that might cause a problem is the fact that the determinant can result in 1/0.
However, after doing the math, both triangles should have a determinant of 16.
And the tangent/bi-tangent for the two triangles should be:
TB vectors
But the shader outputs:

Tangent/Bi-tangent Output

What could cause the shader to draw the extra quad? The output log and the debugger isn’t reacting to anything or giving me errors. It couldn’t have to do with how it’s bound to the pipeline, could it? If that’s the case I could edit that in.

Source: Windows Questions C++

LEAVE A COMMENT