info-inventor
[Top] [All Lists]

Re: Depth Image

To: Tarik Filali Ansary <Filali@xxxxxxx>
Subject: Re: Depth Image
From: "Lars J. Aas" <larsa@xxxxxx>
Date: Wed, 10 Dec 2003 15:40:18 +0100
Cc: "info-inventor@xxxxxxxxxxx" <info-inventor@xxxxxxxxxxx>
In-reply-to: <B0001502119@xxxxxxxxxxxxxxx>
References: <B0001502119@xxxxxxxxxxxxxxx>
Sender: info-inventor-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.24i
Tarik Filali Ansary  <Filali@xxxxxxx> wrote:
: Hi 
: is it possible to create depth image with Open Inventor from a 3D VRML Object?
: i mean to have a structure that have (x,y , Depth(X, Y)) .

Some GL implementations will let you read back the Z-buffer, but I
assume that's not good enough - I don't know if the Z-buffer values
can be reliably translated back into real values with any good
precision.

What you'll need to do is to create your own float array representing
the pixels in your image, and construct the ray that goes from the view-
point through that pixel in the near-plane.  Then you'll use that ray
with an SoRayPickAction and do ray-picking in the scene.  You'll get
the picked-point and the distance between it and the eye-point could
be your depth value.  Sometimes your ray won't hit anything, in which
case depth would be infinity.

Performance-wise, this isn't a very fast way to achieve this, just so
you know.

  Lars J

<Prev in Thread] Current Thread [Next in Thread>