pixels and fragment

Dear All,

What is difference between pixels and fragments


1 Like

A tricky question :slight_smile:

Pixels are smallest points on the display. Fragments are smallest points on image data that is produces by OpenGL. Basically, it means exacly the same, but one pixel on the screen can be a product of more then one fragment due to Z-buffering, bleding etc. Also, it would be not exacly correct to use “pixel” when rendering to textures.

Hovewer, this is just selection of terms. DirectX uses the term pixel.

Me? I prefer “fragments”, this word mirrors the graphics hardware more presice I think.

1 Like

‘We’ generally use the term pixel for refering to a point that is actually (or nearly going to be) rendered at your screen. Whereas fragment generally refers to a ‘potentially pixel’, meaning that it might not be displaid, or might be blend… Operations can still happen on fragments whereas no operations can further happen on pixels.

But this is just a matter of nomenklatura, nothing more just like Zengar said.

OpenGL performs Per-Fragment Operation right before writing pixel data into a frame buffer. Pixels are the output of Per-Fragment Operation, which are containing colour/intensity information only. (what you are actually see on the screen) Fragments are the input data of Per-Fragment Operation, containing more than colour information, such as depth, point size, etc.

These fragments are tested in Per-Fragment Operation, to be converted into pixels. The fragment tests follows in order;
Scissor Test, Alpha Test, Stencil Test, and Depth Test.

Then, blending, dithering logical operation and masking by bitmask are performed, and final pixel data are stored in frame buffer.

I also prefer fragment/fragment shader over pixel/pixel shader in the same reason as Zengar mentioned.