Here's my situation:
I've written a small deferred 3D engine using MRT (Multi Render Target) to fill my G-Buffer (all my position, normal, color and specular textures are filled at the same time).
In addition I've attached to my G-Buffer FBO a Render Buffer Object (RBO) initialized as GL_DEPTH_STENCIL_ATTACHMENT (GL_DEPTH24_STENCIL8). So during the G-Buffer execution my 4 textures are filled simultaneously and the render buffer fills at the same time the stencil and the depth buffer.
I have 2 questions:
- Is it possible to use for any reasons THIS depth buffer as a sampler2D uniform variable within a fragment shader for example I could use to compute something during the lighting pass (for instance, recover vertex position in view-space from depth)? It would be a gain of time to use this depth buffer directly!
If it's not possible :
- Is it possible to fill a depth texture (GL_DEPTH_COMPONENT format) within a MRT? For example, is it possible to fill a depth texture and a color texture using MRT rendering technique ? (I tried without any success but maybe I got caught badly). Do I need to fill my color buffer using MRT, and the depth buffer separatly (two render passes are needed here instead of one)?
If it's not possible again what do you advice me ?
Thanks a lot in advance for your help!
sampler2D
using the ordinarytexture(depthSampler, coordinates);
call)? – peppe