Here is my setup
CameraBase renders the GUI texture.
CameraMatte(with GUIlayer off) renders on top of CameraBase and a obj with depthmask shader.
what I hoped is that the cameraMatte going to cut off the GUI texture using the depthmasked Obj.
However, problem already appear when turning guiLayer off on the cameraMatte, even though cameraMatte renders nothing and depth is set correctly , it would block the guitexlture which is rendered below.
Is this issue unavoidable or there are other ways to do this?
asked Mar 07 '11 at 01:37 PM
A screenshot/video would help, but from what I can gather, you're not understanding what a "depthmask" does. You have to render the depth first, and then you render other objects, whose pixels only get rendered if they are in front of the fragments in the depth buffer.
GUI Textures won't work, because they don't perform a ZTest. Instead, render a quad that renderers after the depthmask, behind the depthmask.
answered Mar 07 '11 at 03:16 PM