Jump to content
  • Advertisement
Sign in to follow this  
BillCruse

Reduction Pixel Shader cost

This topic is 4813 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... I have a question? There are two methods for reduction pixel shader cost as follows: 1.Z-Pass: Before rendering all objects,I write z-value to z-buffer for all objects. 2.Z-Sorting: Rendering images front to back allows the z-test to discard pixels before running through the pixel shader. What is the best selection. Bill.

Share this post


Link to post
Share on other sites
Advertisement
Each of these methods has it's own disadvantages:

1) Rendering depth in advance is a good solution for GeForceFX+ cards, because early Z-cull is introduced only there. Also, you need to be very careful with this early Z-cull, because enabling alpha test in Z-pass will break down hierarchical Z-buffer, and you won't get any benefit. The last thing, Z-pass requires passing almost all scene geometry twice.

2) This-method requires per-object sorting, which is done on CPU and can be not very fast. Also, the same song about Z-cull and alpha-test, which breaks it down.

Your decision depends on scene geometry and average overdraw. More hard pixel shaders overdraw - use first method, more complex scene geometry - use second method (in order ro not to send geomotry twice).
Do yourself a test, and decide, whicj method is better for you.


[Edited by - superpig on September 11, 2005 11:29:08 AM]

Share this post


Link to post
Share on other sites
why would sorting the objects not be fast? the objects aren't going to change in order that many times per frame, if you keep the previous result you can probably get away with like 3 iterations of a bubble sort per frame. [and it being wrong for a single frame isn't that much of a problem, the zbuffer is still doing the sorting proeperly]

Share this post


Link to post
Share on other sites

Both :) Its best to do a rough front to back sort and zfill pass for many applications. Now, depending on your class of target hardware, and pixel shaders, that might be different. If the majority of your pixel shaders are relatively short, the zfill pass may not be a win. If your doing per-pixel lighting its likely your pixel shaders take a decent amount of time. Also note that a z pre pass may save some texture bandwidth as well. Its not free though, as you have to transform the verts at least twice (less if you use occlusion query results from the z pass). Also make sure you use seperate zfill shaders to minimize shader swaps during that pass. If your fill/shader bound it will probably be a benefit.

Share this post


Link to post
Share on other sites
Quote:
Original post by sit
why would sorting the objects not be fast? the objects aren't going to change in order that many times per frame, if you keep the previous result you can probably get away with like 3 iterations of a bubble sort per frame. [and it being wrong for a single frame isn't that much of a problem, the zbuffer is still doing the sorting proeperly]


I just recalled a thread I read here for not so long ago, where sorting algorithms were discussed: Here. Very interesting.

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!