POV-Ray : Newsgroups : povray.programming : z buffer output : Re: z buffer output Server Time
29 Jul 2024 00:34:43 EDT (-0400)
  Re: z buffer output  
From: Heiko Leberer
Date: 19 Feb 1999 11:53:44
Message: <36CD9614.47BB@t-online.de>
Joan Lavoipierre wrote:
> 
> Hi all,
> 
>     Does anyone know of a way to output z buffer information along with
> rendered images? It needs to be fairly accurate since another program is
> going to superimpose realtime 3d shapes which need to interact properly with
> the background. Thanks in advance

I did this once for povray 2.2.

I added a new commandline option, that set a global flag. In the tracing
engine, where the single rays are spawned, I checked after the first
intersection (or a missing intersection), whether the global flag was
set. If z buffer was wanted, I calculated the distance from the
intersection point to the screen pixel. The result was the z-buffer
entry.
I used the RGB value to code a 24bit float (16 bit mantissa, 8 bit
exponent) and returned this new RGB value instead of the color one. With
a little postprocessing (calculating min/max z values, normalizing), I
converted the 24 bit float image into a 16 bit grayscale image.

Unfortunately, I don't have the source any more.

Heiko.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.