I still can't wrap my head around what differences are there between a sample/pixel/fragment.
Since the fragment shader executes per pixel, I think a fragment just refers to a pixel, is this correct? Can anybody give me an example and definition of each one?
A fragment shader executes per fragment and emits pixels. They are very similar, but not the same.
A Fragment is a collection of values produced by the Rasterizer. Each fragment represents a sample-sized segment of a rasterized Primitive. The size covered by a fragment is related to the pixel area, but rasterization can produce multiple fragments from the same triangle per-pixel, depending on various multisampling parameters and OpenGL state. There will be at least one fragment produced for every pixel area covered by the primitive being rasterized. Source
So, if you disable multisampling / antialiasing completely, each fragment should map to one pixel. But if you enable it, multiple fragments will be interpolated to form a single pixel.
The differentiation can also be seen in the Rendering Pipelines of OpenGL here: https://openglinsights.com/pipeline.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With