POV-Ray : Newsgroups : povray.programming : z buffer output : Re: z buffer output Server Time
29 Jul 2024 00:34:48 EDT (-0400)
  Re: z buffer output  
From: Roland Mas
Date: 17 Feb 1999 07:46:02
Message: <m3d8399p2c.fsf@clodomir.rezel.enst.fr>
"Joan Lavoipierre" <xdz### [at] dialpipexcom> writes:

>     Does anyone know of a way to output z buffer information along
> with rendered images?

[I know, I saw Nieminen's post.  But I tried to post this *before* he
posted his thing (and did not manage).  This is a mere solution for
increasing the number of levels in the output, that needs no 16-bit
level.  Ju just use all the 24 bits.]

Colour-code it.  Render a second image with the same objects for which
the texture is changed to something like:

texture {
  pigment {
    gradient <grad-vector>
    colour_map {
      [0/256 1/256 colour rgb 0 colour rgb <0,0,1>]
      [1/256 2/256 colour rgb <0,1/255,0> colour rgb <0,1/255,1>]
      [2/256 3/256 colour rgb <0,2/255,0> colour rgb <0,2/255,1>]
      ...
      [255/256 256/256 colour rgb <0,255/255,0> colour rgb <0,255/255,1>]
    }
  }
  finish {
    ambient 1
    diffuse 0
  }
}

If <grad-vector> is correctly set to be parallel to your camera
direction, and if you translate your texture a bit, then you get a
colour depending on the distance from the focal plane.

The given example gives 65536 levels of accuracy.  If you need more,
you just have to fiddle a bit more and add a colour component on the
red channel.  You see the point.

> It needs to be fairly accurate

The last trick gives you 24 bit depth, that is 16 million or so.
Should be enough.

Roland.
-- 
Roland Mas


- Genki desu, ture en zinc.


Post a reply to this message

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