0
\$\begingroup\$

I am just watching the Shaders intro video from here where the Youtube is saying

3 vertices make up a triangle and Could generate a couple hundred fragments based on how much of the screen that triangle occupies

Its super easy to understand the first thing but the next thing fragment? What actually the fragment is? When we join the three vertices the face will appear which is called a fragment? then how 3 vertices colud generate hundred of fragments?

\$\endgroup\$
5
  • \$\begingroup\$ It is fundamental to understand the stages of the graphics pipeline, en.wikipedia.org/wiki/Graphics_pipeline and what happens during rasterization between geometry and fragment (or pixel) stage. The ubiquitious "triangle" examples found all over the internet demonstrate that pretty well, I find. \$\endgroup\$
    – user144188
    Jan 1 '21 at 12:44
  • \$\begingroup\$ To actually answer your question, you may think of a fragment as a single pixel on your screen, though that is only part of what a fragment is. A fragment also is the accumulation of all calculations done to finally fill that pixel with color, including things like the texture of the shape the graphics card is drawing, the lighting in the scene, depth tested, etc. 3 vertices are used to draw a triangle, no matter how close that triangle is to your camera. Your rasterizer then uses the fragment shader (in opengl) to fill all fragments inside that tri with color. Big triangle = more fragments \$\endgroup\$
    – Jon
    Jan 2 '21 at 6:47
  • \$\begingroup\$ @JonKoelzer Thanks for the input. Big triangle more fragment? I thought the triangle is the smallest entity that we can shade or manipulate. But it seems that one triangle can have many fragments and we can play with each fragment? \$\endgroup\$ Jan 2 '21 at 7:18
  • \$\begingroup\$ You can think of a fragment as a potential pixel. Each fragment is like a container for actual color data which is about to be used to fill a pixel with color. Any mesh we try to draw is just a shape made of triangles, defined by three 3D points. Each triangle on the object takes up space on your monitor when we try to draw it. There is a fragment used for each pixel the triangle covers. That fragment may or may not be drawn, for example, if another fragment would cover it up (depth testing in shaders), or it could even blend with the colors below (a translucent object, or blending). \$\endgroup\$
    – Jon
    Jan 2 '21 at 7:35
  • \$\begingroup\$ See this question here community.khronos.org/t/pixels-and-fragment/29591/3 \$\endgroup\$
    – Jon
    Jan 2 '21 at 7:39

Browse other questions tagged .