POV-Ray : Newsgroups : povray.advanced-users : Another isosurface question : Re: Another isosurface question Server Time
28 Jul 2024 18:20:53 EDT (-0400)
  Re: Another isosurface question  
From: Mike Williams
Date: 21 Jul 2004 19:58:58
Message: <NnhQGBAFMw$AFwAc@econym.demon.co.uk>
Wasn't it Andrew C on Mozilla who wrote:
>It is known that increasing the max_gradiant makes an isosurface go 
>slower. It is also known that if you just divide the result of the 
>function you're drawing, it lowers the max_gradiant, but it won't render 
>any faster.
>
>I was wondering... if I (say) take the square root, that makes the high 
>values less high, while leaving zero unchanged. (I'm assuming 
>threshold=0 here.) Would that make the thing go any faster? Would the 
>increase in speed overcome the extra computation needed for the sqrt() call?
>
>Andrew @ home.

In the general case, strange things happen when you sqrt() an isosurface
function that has threshold=0. That's because POV doesn't like the
sqrt() of negative numbers.

As the POV solver goes looking for a point where a ray intersects an
isosurface, it traps the point in an interval where the function
evaluates positive on one side and negative on the other, and
recursively narrows the interval until it has located the point with the
required accuracy.

If you sqrt() the function, then the POV solver finds itself with an
interval where the value is positive on one side and sqrt(negative) on
the other, which it doesn't like. What tends to happen is that POV knows
when there's a point in the interval, but it fails to find it and paints
the corresponding pixel black.



When the threshold is non-zero, you can write

isosurface { 
  function {  sqrt(F(x,y,z))  -  sqrt(Threshold)  }
  threshold 0

(Note that this is not the same as writing
  function { sqrt( F(x,y,z)-Threshold) }
which produces a black object, as described above.)


I tried some timing experiments. When the max_gradient was changed
appropriately the renderings took exactly the same amount of time.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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