Per Pixel or Per Texel

Started by
7 comments, last by edwinnie 19 years, 7 months ago
Hi, If I have a pixel shader program does it get called per screen pixel or per texture texel? The reason I ask is if I've got a complex pixel shader and a large texture, would things run faster if the texture was smaller? (forgetting about the obvious fact that it uses less memory and bandwidth etc.) Thanks, Fleejay
---Fleejay
Advertisement
The pixel shader gets executed every time a pixel is processed(more accurately,a fragment).So no,it won't speed things up.
ok thanks mikeman, so if I want to speed things up I need to optimise my shader?

Also what is a fragment exactly?
---Fleejay
If you want to speed things up,you can do a million optimizations.Using smaller textures will speed things up a little,not because the shaders will be executed less times,but fot the reasons you mentioned above.
Technically,there is a difference between a fragment and a pixel.A pixel is the smallest element of the screen.A fragment is really the polygon element,that,when projected to the screen,has the size of exactly one pixel.The pixel can be defined by two coordinates(x,y),while the fragment needs 3(x,y,z).
I've always thought of a fragment as part of a final pixel. If you have AA disabled, a fragment is a pixel. If you have 4XAA enabled, it takes several fragments (and runs through the shader, and fetches of texels) to create a pixel.

Maybe mikeman is correct. I don't know. Only OpenGL uses the term. The people who feel a need to point out the difference only ever say is "fragment != pixel", which doesn't really educate you as to the correct usage.
Quote:Original post by Namethatnobodyelsetook
A fragment is part of a final pixel. If you have AA disabled, a fragment is a pixel. If you have 4XAA enabled, it takes several fragments (and runs through the shader, and fetches of texels) to create a pixel.


I think you're confusing samples with fragments.
So when the graphics card is rasterising the polygons it looks at whether or not anti-aliasing is enabled to determine how many fragments to calculate and draw. These fragments are then combied to form the on screen pixels.

Thanks for your help.
---Fleejay
ahhh! I was in the middle of a post only to post it and find out that it was wrong. Ok, so fragments are what pixels are called on the graphics card before they hit the screen and samples are like small sub-pixels.
---Fleejay
u can get a speed up fer ur fragment shader if u do explicit early z culling & make use of an F Buffer...

cheers!
Edwinz

This topic is closed to new replies.

Advertisement