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

Per Pixel or Per Texel

Started by fleejay Aug 27, 2004 at 6:50 AM 7 replies 2.5k views
Original Post
fleejay
fleejay
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
fleejay
fleejay
ok thanks mikeman, so if I want to speed things up I need to optimise my shader?

Also what is a fragment exactly?
---Fleejay
mikeman
mikeman
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).
Namethatnobodyelsetook
Namethatnobodyelsetook
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.
mikeman
mikeman
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.
fleejay
fleejay
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
fleejay
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
edwinnie
edwinnie
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

Topic Locked

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

Sign in to reply to this topic.