POV-Ray : Newsgroups : povray.programming : z buffer output : Re: z buffer output Server Time
29 Jul 2024 00:27:33 EDT (-0400)
  Re: z buffer output  
From: Roland Mas
Date: 17 Feb 1999 13:00:50
Message: <m3hfsmzaww.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?

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

Sauvez un arbre, tuez un castor.


Post a reply to this message

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