POV-Ray : Newsgroups : povray.general : Isosurface help : Re: Isosurface help Server Time
30 Jul 2024 12:32:01 EDT (-0400)
  Re: Isosurface help  
From: sumdumguy
Date: 22 Jan 2009 03:50:01
Message: <web.4978326bfb628f71dd43aa390@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> 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

Ah, so it seems I have the master's attention. So before going any further, many
thanks for your isosurface tutorial, it has been a terrific resource.

Now I tried what you have suggested before and got very weird results. Your
reply here has helped me understand where the problem was. You see, I was
really trying to do something like so:

function {P1(x,y,z)*P2(x,y,z)+f_noise3d(x*10, y*10, z*10)*0.3-0.03}

and when I add noise (values straight from the tutorial here, it creates a
problem: the joint shape partly disappears.
And I do not think it has to do with max_gradient. Rather it seems to be due to
the noise function going above threshold. Any suggestions for making this shape
wrinkly?


Post a reply to this message

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