Jump to content
  • Advertisement
nOoNEE

OpenGL what is difference between pixel and fragment exactly in openGl ?

Recommended Posts

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

 

 

Share this post


Link to post
Share on other sites
Advertisement
Posted (edited)
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

Edited by Finalspace

Share this post


Link to post
Share on other sites
Posted (edited)
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 ? 

 
  •  
Edited by nOoNEE

Share this post


Link to post
Share on other sites
Posted (edited)
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

 

Edited by ChuckNovice

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!