POV-Ray : Newsgroups : povray.advanced-users : Isosurface problem. : Re: Isosurface problem. Server Time
2 Nov 2024 07:26:56 EDT (-0400)
  Re: Isosurface problem.  
From: Mike Williams
Date: 14 Feb 2000 11:53:04
Message: <GJSGtFAp7Cq4EwIu@econym.demon.co.uk>
Wasn't it Simen Kvaal who wrote:
>Why does this work:
>
>
>
>isosurface {
>        function {
>                (2*x^2+y^2+z^2-1)^3 - (0.1)*x^2*z^3-y^2*z^3
>
>        }
>        threshold 0
>        accuracy 0.0001
>        max_gradient 20
>        max_trace 2
>        contained_by { sphere { 0, 7 } }
>        pigment {
>                color Grey
>        }
>}
>
>but not this:
>
>
>#declare Heart =
>    function {
>                (2*x^2+y^2+z^2-1)^3 - (0.1)*x^2*z^3-y^2*z^3
>    }
>
>isosurface {
>        function {
>                Heart(x, y, z)
>
>        }
>        threshold 0
>        accuracy 0.0001
>        max_gradient 20
>        max_trace 2
>        contained_by { sphere { 0, 7 } }
>        pigment {
>                color Grey
>        }
>}


The problem is related to the fact that you have lied about the
max_gradient value, and Megapov has trusted your value. If you replace
the line "max_gradient 20" by "eval" (and render a very small image,
otherwise it takes forever) then Megapov will calculate the true
max_gradient and log it in the statistics output. 

What's probably happening is that it starts looking for your surface by
guessing that it might be close to the surface that contains it, and
then goes hunting up and down the ray looking for a location where the
function gets close to the threshold value.

If we consider a ray that approaches your object from the -z direction,
it probably starts its search from the point <0,0,-7> on the
contained_by sphere. At that point, your function evaluates to 110592.
Now, you've told it that the max_gradient is 20, and if that were true,
then there can't be a position within 5530 units where the function
evaluates to zero. So Megapov believes that there can't possibly be such
a point anywhere along the ray from <0,0,-7> to <0,0,7>.

Actually, the correct max_gradient is about 584035, however, if you try
using that value you'll find that it takes several years to render your
image at a reasonable size. Your contained_by surface is ridiculously
large, and your function is sixth order, so you're telling Megapov to go
looking in areas where the value of the function is of the order of 7^6,
i.e. 117649. Try containing the surface in the sphere {0,1.5} where the
function is of the order of 1.5^6, i.e. 11.39.


I don't know why there's no problem with the first version, but I do
notice that eval doesn't cause any isosurface function stats to be
logged. I guess that the way it locates the surface must be completely
different and, for some reason, it doesn't use your max_gradient value.

-- 
Mike Williams + #
Gentleman of Leisure


Post a reply to this message

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