POV-Ray : Newsgroups : povray.newusers : coincident isosurfaces and noise : Re: coincident isosurfaces and noise Server Time
30 Jul 2024 16:25:27 EDT (-0400)
  Re: coincident isosurfaces and noise  
From: Mike Williams
Date: 18 Jan 2004 00:28:05
Message: <KfU6rIAbkhCAFw6Z@econym.demon.co.uk>
Wasn't it Bill Hails who wrote:
>Hi.
>I'm probably doing something wrong, but ...
>
>I would assume that if I have two isosurfaces
>that are coincident along a line, say the top
>of a cylinder oriented along x touching a y plane,
>and if I add or subtract the same noise function
>to both isosurfaces, say f_noise3d, then the
>resulting surfaces would still be coincident
>(along a now distorted line).
>
>That's not what I seem to be getting, I have to
>multiply the noise by a constant for one of the
>surfaces to get it to coincide with the other,
>and I have to guess the constant :-(
>
>My code is ugly and a lot more complicated than
>I've just described, so it's more than likely
>that I've made a mistake somewhere, but I've been
>staring at it for over an hour and can't see it.
>
>Any help gratefully recieved. I can post the code
>if my question isn't clear.


It just happens that that's not the way it works. Adding f_noise3d to
two different functions doesn't move points on the isosurface the same
distance in space, it moves the points to the locations where the
underlying functions have the same value. That's going to be different
unless the two original functions have the same gradient throughout the
region.

Consider the functions

        F = function { y }
        G = function { 2*y }

        F2 = function { y + f_noise3d(x,0,z)}
        G2 = function { 2*y + f_noise3d(x,0,z)}

[I'm using (x,0,z) rather than (x,y,z) so that the pattern is the same
for different values of y, which makes the following sums much easier.]

F and G generate the same plane because "2*y = 0" gives the same y
values as "y = 0".

F2 and G2 generate different surfaces.

If we look at the point at x=1 z=1, we can discover that
f_noise3d(1,0,1) returns the value 0.292676, so F2 at that point can be
calculated by
        y + f_noise3d(1,0,1) = 0
        y + 0.292676 = 0
        y = -0.292676
but the point on G2 is calculated by
        2*y + f_noise3d(1,0,1) = 0
        2*y + 0.292676 = 0
        y = -0.146338
Which is not the same.



What you can to do instead is to use variable substitution to move
corresponding points on the isosurfaces the same distances in space.
Like this:-

        #declare F = function{y}
        #declare G = function{2*y}
        #declare F3 = function {F(x, y+f_noise3d(x,y,z), z)}
        #declare G3 = function {G(x, y+f_noise3d(x,y,z), z)}

F3 and G3 do generate the same noisy isosurface.

In general, you may want to apply variable substitution to all three 
co-ordinates

#declare F3 = function {F(x+f_noise3d(x,y,z), 
                          y+f_noise3d(x,y,z),
                          z+f_noise3d(x,y,z))}

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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