Advertisement

what is difference between pixel and fragment exactly in openGl ?

Started by June 17, 2018 06:25 AM
4 comments, last by d07RiV 6 years, 7 months ago

i am reading this book : link

in the OpenGL Rendering Pipeline section there is a picture like this: link

but the question is this i dont really understand why it is necessary to turn pixel data in to fragment and then fragment into pixel could please give me a source or a clear Explanation that why it is necessary ? thank you so mu

 

 

Just now, nOoNEE said:

i am reading this book : link

in the OpenGL Rendering Pipeline section there is a picture like this: link

but the question is this i dont really understand why it is necessary to turn pixel data in to fragment and then fragment into pixel could please give me a source or a clear Explanation that why it is necessary ? thank you so mu

 

 

In OpenGL you can have subpixel accuracy when bilinear filtering is active.

So a fragment is one of that subpixels, but when nearest filter is active - a fragment equals one pixel.

Also a fragment is always a filled portion of a geometric object, such as a triangle, quad, etc - A pixel is just one point on your screen - not necessarily to be filled. Oh and fragments are defined in clip-space and pixels are obviously in screen space.

https://www.khronos.org/opengl/wiki/Fragment_Shader

 

And if you are really want to know how a 3D renderer such as OpenGL works, you can check out: https://www.youtube.com/watch?v=Y_vvC2G7vRo&list=PLEETnX-uPtBUbVOok816vTl1K9vV1GgH5

Advertisement
8 minutes ago, Finalspace said:

In OpenGL you can have subpixel accuracy  when bilinear filtering is active.

So a fragment is one of that subpixels, but when nearest filter is active - a fragment equals one pixel.

you mean with Rasterization there will be more accuracy ? i don still get it costs price for us while we have data pixel why we should turn it to the fragments and then turn this to the pixels ? 

 
  •  
3 hours ago, nOoNEE said:

you mean with Rasterization there will be more accuracy ? i don still get it costs price for us while we have data pixel why we should turn it to the fragments and then turn this to the pixels ? 

 
  •  

 

I may be wrong but I think they accounted for the fact that the smallest unit possible is not necessarily always a pixel or a uniform grid. Take for example MSAA and the way they distribute the samples position inside a pixel. From how I understand it each of these sample would be a "fragment" :

IC554624.png

IC554625.png

 

Quote

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.

However, I'm not sure if individual samples generated for MSAA count as separate fragments, since FS is only ran once.

This topic is closed to new replies.

Advertisement