POV-Ray : Newsgroups : povray.general : distance pattern ? : Re: distance pattern ? Server Time
6 Aug 2024 00:14:03 EDT (-0400)
  Re: distance pattern ?  
From: Warp
Date: 9 Jul 2002 21:35:28
Message: <3d2b8f5f@news.povray.org>
Rafal 'Raf256' Maj <raf### [at] raf256com> wrote:
> Hi,
> realy couldn't find one thing in manual... there AFAIR was some pattern 
> (used i.e. in media) that value in <x,y,z> was equal to distance beetwen 
> <x,y,z> and some object

  If there would be a fast way of determining the distance of a point from
the surface of an object, that would be more or less a holy grail of
raytracing. (Among other things it would allow you to create an isosurface
identical to any given object and then just transform it non-linearly.)

  The sad fact is that there's no generic way of calculating this distance
fast and accurately for any given object.
  The patch you are referring to _approximated_ the distance by shooting
many rays towards the object and taking the one which hit the object at
closest distance. Of course this has two drawbacks: It's not very accurate
(usually introduces bad graininess) and it's very slow.

  There was a discussion some time ago (I think initiated by me) that the
distance calculation could be optimized in a per-primitive basis (for many
primitives getting the accurate distance fast is quite easy), as well as
developing a proper algorithm for calculating it analytically for a CSG
object. (Of course there are objects where you *can't* get the accurate
distance from the surface, eg. the 4D julia object. For some objects it
might not be unambiguous which distance is the correct one.)

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

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