Hi guys,
I encounter a problem when using FBO in deferred shading system, my rendering pipeline is like this:
- render the scene into GBuffers using MRT;
- calculate sky lighting in screen space and output to a color texture;
- output color texture to main frame buffer;
The problem is I wanna step 2 share depth buffer with step 1, so the calculation in step 2 only happen on pixels that is useful.
I tried create render buffer in step 1 and bind it in the FBO create in step 2 (using glFramebufferRenderbuffer), but the result is not as excepted, the depth test is not correct in step 2 and no pixel be drawn.
Anyone has done this before? or is any other way to share depth buffers among FBOs or FBO & Main FrameBuffer? any suggestion will be appreciated.