POV-Ray : Newsgroups : povray.advanced-users : depth values / hit times : Re: depth values / hit times Server Time
28 Jul 2024 18:12:00 EDT (-0400)
  Re: depth values / hit times  
From: Chris Johnson
Date: 22 Apr 2004 10:19:10
Message: <4087d45e$1@news.povray.org>
-[Any pointer where in the source I should look first?]-

The function 'Trace_Primary_Ray' in vbuffer.cpp is the place. When the vista
buffer is off, pov-ray uses the 'Trace' function in render.cpp.

My implementation just comments out everything in Trace_Primary_Ray after
line 235 of vbuffer.cpp (in my source from May 2003):

Intersection_Found = intersect_vista_tree(Ray, Root_Vista, x,
&Best_Intersection);

and replaces it with

Colour[0]=Best_Intersection.Depth/50;
Colour[1]=Best_Intersection.Depth/50;
Colour[2]=Best_Intersection.Depth/50;
return (Best_Intersection.Depth);

The divisor by 50 seemed to give about the right brightness for the scale of
my scenes. This is entirely arbitrary - perhaps a logerithmic function would
be more suitable.

The code is very similar for modifying the Trace function if necessary,
though +UV can be used as a parameter when rendering to force the use of the
Trace_Primary_Ray function.

This code was a hack done in a few minutes to see if I could compile the pov
sources. I havent tested it extensively at all - it seems to work with
"normal" settings though. I haven't tried turning photos on radiosity on
while using it: whether they affect the image in subtle ways I'm not sure. I
have tried it with 16 bit output accuracy though, and it works fine.

-Chris


Post a reply to this message

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