POV-Ray : Newsgroups : povray.advanced-users : Isosurface speed : Re: Ooo... a solution? Server Time
6 Oct 2024 15:19:13 EDT (-0400)
  Re: Ooo... a solution?  
From: Michael (Micksa) Slade
Date: 27 Sep 2006 06:52:47
Message: <pan.2006.09.27.10.53.03.34363@knobbits.org>
On Mon, 28 Aug 2006 15:58:02 +0100, Orchid XP v3 wrote:

> I just had a brainwave!
> 
> I changed fn(x, y, z) to log(fn(x, y, z)), and changed the max_gradient 
> to 4. I'm now getting several thousand pixels/second.
> 
> Of course - the logarithm function makes the crazy vertical sides less 
> "vertical", while not flattening out the parts near the solutions so 
> POV-Ray still has some contours to go on.
> 
> (I read somewhere that dividing your function by a big number makes 
> max_gradient lower, but doesn't make it trace any faster. But this trick 
> makes the big numbers small, but leaves the small numbers alone so 
> POV-Ray doesn't go around taking tiny steps there any more.)

Okay, so I'm making the mistake of reading this group even though I'm not
really an expert at povray (I have made a couple of moderately
complex scenes but compared to whats on irtc I'm a novice), and I'm
finding this isosurface stuff fascinating.  So I'm going to attempt to
contribute with my knowledge of maths and some educated guesses about how
the isosurface stuff works.  Feel free to correct or flame me.

AIUI, the isosurface stuff works by assuming that the function's value
won't change by more than x/max_gradient over a distance of x, so it uses
this and an algorithm sorta like newton's method or the sturmian root
solver to find points that lie on the surface.  This all gets ugly if the
function, like, has an order greater than 1, or has an exponential or 1/x
in it, etc, since these functions have derivatives that increase
indefinitely in certain regions.

But all of these functions can be mapped to functions where there is a
one-to-one mapping between the zero values (or the values that we want
mapped to the surface), and whose derivatives are bounded.  For example,

x^2 = 10

Its derivative is x which increases indefinitely, but if we go

sqrt(x^2) = sqrt(10)
x = sqrt(10)

Then we end up with a function whose derivative is bounded and whose 0
locus (sorry if I'm not using correct terminology here) is still the same.

This is what Orchid effecitively did with his exponential function.  By
taking the log of the whole function he created a new function with the
same properties.

For the function x^2 this is trivial - it produces a new function which is
easily used in an isosurface anyway.  Orchid's function was less obvious.

I'm curious, could this kind of thing theoretically be done automatically
by povray?  What if it were to use log(function) or sqrt(function) or
1/function to find the surface points rather than the actual function, and
the max_gradient were to apply to that function instead of the original?

Mick.

-- 
Remove the -news from my email address.
http://mickworld.knobbits.org/


Post a reply to this message

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