POV-Ray : Newsgroups : povray.newusers : coincident isosurfaces and noise Server Time
26 Nov 2024 19:31:49 EST (-0500)
  coincident isosurfaces and noise (Message 1 to 6 of 6)  
From: Bill Hails
Subject: coincident isosurfaces and noise
Date: 17 Jan 2004 19:45:45
Message: <4009d739@news.povray.org>
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.

-- 
Bill Hails


Post a reply to this message

From: Bill Hails
Subject: Re: coincident isosurfaces and noise
Date: 17 Jan 2004 20:01:44
Message: <4009daf8@news.povray.org>
PS, I'm not doing any translation or scaling of either
isosurface.

-- 
Bill Hails


Post a reply to this message

From: Christopher James Huff
Subject: Re: coincident isosurfaces and noise
Date: 17 Jan 2004 23:13:43
Message: <cjameshuff-A8E688.23140617012004@netplex.aussie.org>
In article <4009d739@news.povray.org>,
 Bill Hails <bil### [at] europeyahoo-inccom> wrote:

> 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).

I'm not really sure what you want. You have a cylinder resting on a 
plane, and want a deformed cylinder resting on a deformed plane?
Within limits, adding noise to the cylinder function is equivalent to 
varying the radius of the cylinder, adding it to the plane function 
varies the height of the plane. I think you are expecting it to always 
move a given point on the surface in the same direction by the same 
distance. For that, you will need to perturb the coordinates given to 
the function...the easiest way would be to use warps:

function {pattern {function {...} turbulence ...}}

Apply the same warp to both isosurfaces, and they will be deformed in 
the same way.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Mike Williams
Subject: Re: coincident isosurfaces and noise
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

From: Bill Hails
Subject: Re: coincident isosurfaces and noise
Date: 18 Jan 2004 03:15:07
Message: <400a408a@news.povray.org>
Many thanks Mike. That's perfect, and exactly what I needed to know.

FYI it's not actually a cylinder, it's the "hoop sweep"
surface from your isosurface tutorial, so you've helped me
out twice already with this pic :-)

I'll post a small render to pbi sometime today, after fixing it up.
-- 
Bill Hails


Post a reply to this message

From: Bill Hails
Subject: Re: coincident isosurfaces and noise
Date: 18 Jan 2004 03:49:00
Message: <400a487c@news.povray.org>
Hi Christopher,

Christopher James Huff wrote:

> In article <4009d739@news.povray.org>,
>  Bill Hails <bil### [at] europeyahoo-inccom> wrote:
> 
>> 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).
> 
> I'm not really sure what you want. You have a cylinder resting on a
> plane, and want a deformed cylinder resting on a deformed plane?

pretty much that, yes.

> Within limits, adding noise to the cylinder function is equivalent to
> varying the radius of the cylinder, adding it to the plane function
> varies the height of the plane. I think you are expecting it to always
> move a given point on the surface in the same direction by the same
> distance. For that, you will need to perturb the coordinates given to
> the function...the easiest way would be to use warps:
> 
> function {pattern {function {...} turbulence ...}}
> 
> Apply the same warp to both isosurfaces, and they will be deformed in
> the same way.
> 

Thanks. Between you and Mike, I think I know enough to move forward.
perturb the arguments to the function rather than adding noise to
the result.

-- 
Bill Hails


Post a reply to this message

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