Early Z Pass occlusion
Posted: Sun Apr 19, 2009 11:25 am
There is allot of talk about saving fillrate with portals, occlusion culling and deffered rending.
How about an early z-only pass? its very easy to implement in irrlicht. If you have transform time to waste, you can redner the scene with a z write only which is extremely fast since there is no fragment processing and most of the vertex processing is shutdown(like interpolation of colours and tcoords). Then without clearing the depth buffer render the scene again with colour write on, all the new rendering is z compared and any occluded fragments are killed early, thats per pixel occlusion culling with 0 overdraw!.
I have tried this on a quake map with parallax mapping and made a considerable diffrence to the framerate (not much of a framerate diffrence using the normal shading).
The only trouble i see is if some one activates this method where they use a shader that modifies fragment depth, the fragment shader is off during the z only pass hence the fragment will not use the depth made from the pixel shader. In that case the early z pass can be a SMaterial flag which can be true for most scenenodes. Similar to the HW buffers hints.
I rendered the objects with this flag in the scenemanger near the shadow pass and made the setMaterial method in the video driver read the SMaterial flag and disable colour writes when needed.
Is there any hope for this going into irrlicht?
How about an early z-only pass? its very easy to implement in irrlicht. If you have transform time to waste, you can redner the scene with a z write only which is extremely fast since there is no fragment processing and most of the vertex processing is shutdown(like interpolation of colours and tcoords). Then without clearing the depth buffer render the scene again with colour write on, all the new rendering is z compared and any occluded fragments are killed early, thats per pixel occlusion culling with 0 overdraw!.
I have tried this on a quake map with parallax mapping and made a considerable diffrence to the framerate (not much of a framerate diffrence using the normal shading).
The only trouble i see is if some one activates this method where they use a shader that modifies fragment depth, the fragment shader is off during the z only pass hence the fragment will not use the depth made from the pixel shader. In that case the early z pass can be a SMaterial flag which can be true for most scenenodes. Similar to the HW buffers hints.
I rendered the objects with this flag in the scenemanger near the shadow pass and made the setMaterial method in the video driver read the SMaterial flag and disable colour writes when needed.
Is there any hope for this going into irrlicht?