POV-Ray : Newsgroups : povray.general : Isosurface help : Re: Isosurface help Server Time
30 Jul 2024 12:19:11 EDT (-0400)
  Re: Isosurface help  
From: Mike Williams
Date: 22 Jan 2009 02:10:06
Message: <eKdRUPKLuBeJFw9n@econym.demon.co.uk>
Wasn't it sumdumguy who wrote:
>This is more or less a math question not syntax question. Still, I have killed
>many hours on this and so maybe someone has an idea.
>Say I have an isosurface:
>
>
>#declare  P = function {x*x + y*y + z*z - 1}
>
>isosurface {
>        function {P(x*2,y*(1.05-y/6),z*2)}
>        threshold 1
>        accuracy 0.001
>        max_gradient 200
>        contained_by{sphere{<0,0,0>,3}}
>        pigment {rgbt <0,1,0>}
>}
>
>This gives a stretched sphere where one side is squashed and the other
>is more sharp. Now what I want to do is to modify this isosurface so that
>there is also a bump on the surface, kind of like a wart on the nose.
>Any ideas on how to do this would be appreciated.

The way I'd do it is:

First: Eliminate the Threshold value by subtracting 1 in the function {}
        function {P(x*2,y*(1.05-y/6),z*2) -1}

Then: Create a separate isosurface in the right location. It's much
easier to design this as a separate isosurface and then blob it onto the
nose later.
      isosurface {
        function {P(x*2,y*(1.05-y/6),z*2) -1}
        accuracy 0.001
        max_gradient 200
        contained_by{sphere{<0,0,0>,3}}
        pigment {rgbt <0,1,0>}
      }
      isosurface {
        function {P(x*4+1,y*4,z*4+2) -1}
        accuracy 0.001
        max_gradient 100
        contained_by{sphere{<0,0,0>,3}}
        pigment {rgbt <1,0,0>}
      }

Once that's looking reasonable: Multiply the two functions together and
subtract a small constant. The smaller the constant, the sharper will be
the blending between the two isosurfaces. You may need to increase
max_gradient.

#declare  P = function {x*x + y*y + z*z - 1}

#declare  P1 = function {P(x*2,y*(1.05-y/6),z*2) -1}
#declare  P2 = function {P(x*4+1,y*4,z*4+2) -1}

isosurface {
        function {P1(x,y,z)*P2(x,y,z) -0.03}
        accuracy 0.001
        max_gradient 5950
        contained_by{sphere{<0,0,0>,3}}
        pigment {rgbt <0,1,0>}
}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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