Jump to content
  • Advertisement
Sign in to follow this  
fleejay

Per Pixel or Per Texel

This topic is 5164 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
The pixel shader gets executed every time a pixel is processed(more accurately,a fragment).So no,it won't speed things up.

Share this post


Link to post
Share on other sites
ok thanks mikeman, so if I want to speed things up I need to optimise my shader?

Also what is a fragment exactly?

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!