1
\$\begingroup\$

I have some problems with my displacment. So I would like to have a simple little isoline starting in every triangles face center of the mash pointing in the direction of the corresponding faces normal direction. like in the following picture (okay these are no triangles, but still something like that): enter image description here Can I draw isoline in my shader when the topology is a trianglelist? if yes, how do I do that?

\$\endgroup\$
1
  • \$\begingroup\$ I cannot see any isolines in your image, do you refer to the drawn normals or the wireframe? \$\endgroup\$
    – danijar
    Nov 25, 2013 at 8:59

1 Answer 1

2
\$\begingroup\$

No, you cannot mix different primitive types in the same shader / draw call. If you're drawing triangles, you can't also draw line segments.

To draw face normals like this, you could do a second draw call with a geometry shader that generates the line segment for each face.

\$\endgroup\$
3
  • \$\begingroup\$ does that mean, that I can reuse the vertex shader and than just use the geometry shader and than just write a simple pixel shader. When I'm reusing the vertex shader, can I use the same description and layout as befor? And I can still use a triangle list with isolines? How do I call a second draw call? \$\endgroup\$
    – Jinxi
    Nov 25, 2013 at 9:03
  • \$\begingroup\$ @Jinxi Yes, you can re-use the same vertex shader, vertex buffers etc., and the geometry shader can convert triangles into lines. By a "second draw call" I just mean draw it once with the regular shader and draw it again with the geometry shader to generate the lines. \$\endgroup\$ Nov 25, 2013 at 17:44
  • \$\begingroup\$ so it would look something like: deviceContext->IASetInputLayout(m_layout); // set shaders deviceContext->VSSetShader(m_vertexShader, NULL, 0); deviceContext->HSSetShader(m_hullShader, NULL, 0); deviceContext->DSSetShader(m_domainShader, NULL, 0); deviceContext->PSSetShader(m_pixelShader, NULL, 0); // samplerstate... // draw deviceContext->DrawIndexed(indexCount, 0, 0); // set normalshaders deviceContext->VSSetShader(m_vertexShader, NULL, 0); deviceContext->GSSetShader(m_gs, NULL, 0); deviceContext->PSSetShader(m_ps, NULL, 0); // draw again deviceContext->DrawIndexed(indexCount, 0, 0); \$\endgroup\$
    – Jinxi
    Nov 28, 2013 at 13:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .