POV-Ray : Newsgroups : povray.programming : About Intersection points : Re: About Intersection points Server Time
6 Oct 2024 15:21:55 EDT (-0400)
  Re: About Intersection points  
From: Christopher James Huff
Date: 9 Nov 2002 12:24:27
Message: <chrishuff-B89E79.12242009112002@netplex.aussie.org>
In article <3dcca947@news.povray.org>, "Wu Yang" <wya### [at] cswrightedu> 
wrote:

> I want to compute the distance between the camera and the intersection
> points made by camera rays and objects.

If you don't need POV 3.5 and can take the data in the form of an image, 
MegaPOV had a "depth" post process filter. You can also do tricks with 
fog or textures to get a depth buffer. Use black textures and white fog, 
so things get white with distance (or white textures and black fog, for 
the opposite gradient), or texture everything with a spherical texture 
centered on the camera and scaled large enough to contain the scene.

Otherwise: 
Trace_Primary_Ray() in vbuffer.cpp and Trace() in render.cpp both return 
the distance to the nearest intersection if there is one, or BOUND_HUGE 
if there wasn't one. Look at the trace_pixel() function, you need to 
save the results of Trace_Primary_Ray() and Trace().

If you can use depth data in an image and don't need the rendered image, 
you could put the depth values in the rendered image by changing Color, 
but it would be better to modify those two functions to skip the texture 
and atmosphere calculations instead, it would be much faster rendering.

This won't work with focal blur, that would be a bit more work, but 
probably isn't needed. You would have to decide what kind of depth 
information you wanted there: minimum, maximum, midpoint of those, 
average...

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

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