How fragment shader determines the number of fragments from vertex shader output?

前端 未结 1 662
野性不改
野性不改 2021-01-03 00:29

I\'m familiar with vertex and fragment shaders but still confused about how a fragment shader determines the amount of fragments from the output of vertex shader.

If

相关标签:
1条回答
  • 2021-01-03 00:58

    You're talking about the step in rasterization known as scan-conversion. The GPU takes the positions generated by your vertex shader and interpolates their attributes to produce the fragments that are passed to your fragment shader. So yes, it is essential for you to set gl_Position in the vertex shader.

    After converting the coordinates of a triangle to window coordinates, scan conversion takes the triangle and breaks it up based on the arrangement of window pixels over the output image that the triangle covers. Source.

    scan conversion of a triangle

    0 讨论(0)
提交回复
热议问题