Skip to main content
GameDev.net gamedev.net
🔒 Locked

Per-pixel vs Per-fragment shading

Started by ksharma Apr 24, 2004 at 5:25 AM 4 replies 5.2k views
Original Post
ksharma
ksharma
Can anyone tell whatz the difference b/w Per-pixel vs Per-fragment shading ? Does the fragment program uses per-pixel shading ?
davepermen
davepermen
fragments and pixels are about the same. in opengl, they are called fragments, in dx, they are called pixels (and, because of antialiasing and multiple samples and all, opengl is more correct/detailed).

but if you use ps2.0 in dx, or ARB_fragment_program in opengl, it''s the same.




If that''s not the help you''re after then you''re going to have to explain the problem better than what you have. - joanusdmentia

davepermen.net
If that's not the help you're after then you're going to have to explain the problem better than what you have. - joanusdmentia
My Page davepermen.net | My Music on Bandcamp and on Soundcloud
ksharma
ksharma
Thanks.

But I wanted to know what is the difference ? Between pixel and fragment ?
tok_junior
tok_junior
There's no difference except for the spelling and the pronounciation.


[edited by - tok_junior on April 24, 2004 7:27:43 AM]
OrangyTang
OrangyTang
A pixel is a single colour block on screen. A fragment is the openGL term, its something that passes though the rendering pipeline before actually setting a pixel colour.

So when you draw a triangle it gets converted into a whole bunch of fragments (one for every pixel it covers). Fragments get coloured from textures, lighting etc. and then finally written to the colour buffer (before going to the sceen and being displayed as a pixel).

The distinction becomes important when you realise that you can use multiple fragments to set a final pixel colour (transparency) and fragments may not actually become a pixel (eg. fail depth test).
sBibi
sBibi
quote:
There''s no difference except for the spelling and the pronounciation.


that is incorrect.
they are _not_ the same at all. pixels are what you see on your screen, what the final image you render will be made of.
fragments can be seen as in-between step. they result from triangle rasterisation, and in a programmble pipeline, go through a fragment program (pixel shader). when you have no antialiasing, 1 pixel = 1 fragment. however, with antialiasing turned on (an antialiasing based on multisampling that is..), you get multiple fragments for each pixel. 4 fragments per pixel for 4x antialiasing, 8 for 8x, etc...

now as someone mentioned earlier, d3d doesn''t make a difference (witch is bad imho, because it makes the whole thing a lot more confusing, same as the term "shader", witch is overused and misused. OpenGL has a far better naming for this stuff).
however, "pixel shaders" and "fragment programs" do refer to the same thing.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.