PDA

View Full Version : Depth output from another POV



nicolas
02-17-2012, 08:09 AM
Hi,

I want to output depth from a POV at fragments whose coordinates are from another POV.
In fact, I want to display objects from my camera POV, but for each fragment, I want to render depth from another camera POV.
Is that possible ?

[EDIT]

I will try to explain myself better.
In fact, I have some object seen from my main POV, the one used to display objects.
I would like render those objects exactly but from another POV, in order to get depth and some other things.

menzel
02-17-2012, 09:08 AM
You want the depth at each position visible from camera A relative to another cameras position B?

If that's what you want, that's possible by projecting the fragments onto the 2. camera in a fragment shader. That's also done for shadowmapping, maybe you want to look up how that's done and if it helps with your problem.

V-man
02-17-2012, 11:48 AM
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

SetupCamera();
RenderObjects();

glClear(GL_DEPTH_BUFFER_BIT); //Clear depth only
glColorMask(FALSE, FALSE, FALSE, FALSE); //Will disable color writes
Setup_NEW_Camera_POV();
RenderObjects();
glColorMask(TRUE, TRUE, TRUE, TRUE);

nicolas
02-22-2012, 12:57 AM
In fact, what I need is much more complex than that, and I drop off this idea because of its complexity (F*M*N) in my case, which is far from RT.
But thanks everyone for your answers, it may help others (or me, another time!)