Draw Order Question (Z-Test, Depth-Stencil)
Members - Reputation: 361
Posted 23 November 2012 - 01:36 AM
I've read that if i use the depth-stencil for a mirror i should draw the objects from back to front so that the depth can be checked.
Later i've read that if i want my graphic card to uses the build in z-test(Hardware - don't render if the depthComplexity > 1) i have to draw the objects from front to back (and it can have a significantly impact in performance)
So, whats the right way?
from time to time i find time
Crossbones+ - Reputation: 13444
Posted 23 November 2012 - 01:56 AM
Though, as always, there are some exceptions. E.g. alpha blending can't utilize the z-test , therefore alpha blended geometry should be rendered from back to front to avoid visual artifacts.
Crossbones+ - Reputation: 3838
Posted 23 November 2012 - 02:19 AM
However, you can also improve performance by batching triangles into single draw calls and by drawing 'similar' objects together so as to reduce state changes. This can improve both CPU and GPU performance.
These two goals often conflict with one another. I tend to give greater weight to the second goal, only worrying about the first if I can cheaply and easily do some coarse sorting. Unless I'm in full profiling/optimising mode, then I'll let measurements and experiments tell me what to do.