POV-Ray : Newsgroups : povray.animations : Isosurface 'water' but it goes concave Server Time
28 Jul 2024 12:28:42 EDT (-0400)
  Isosurface 'water' but it goes concave (Message 1 to 9 of 9)  
From: John D  Gwinner
Subject: Isosurface 'water' but it goes concave
Date: 7 Jul 2001 17:02:09
Message: <3b4778d1$1@news.povray.org>
Folks:

  (modification of post in general)

  I'm trying to figure out the best way to do an aquarium.  I want to show
the 'ripple pattern' of light moving across the top surface of the water.  I
want this to be in effect
a clear block (with an IOR) with a 'wavy' top surface.

  The closest I have so far is an Isosurface, which looks good but when I
animate it I get something odd: 'phase' identifier in the wrinkles (or waves
or ripples) causes the surface to move *down* not across, so it causes a
concavity.  I tried different combinations of functions, rotations, etc. and
it doesn't seem to work.   An example - I replaced 'clock' in the phase with
a .5 so you can see what it looks like.

  It's a neat effect but it's not what I'm looking for ;-)

  Any suggestions?

         == John ==

#version unofficial MegaPov 0.7;

#declare R=1.0;
#declare R1=R+0.01;
#declare Box = 1;

camera { location  <5*R, 5*R, -8*R> look_at <0, 0, 0> angle 20}

sky_sphere { pigment {
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

light_source {<100,200,-100> colour rgb 1}


#declare WaveDepth = .5;

#declare WrinklesFunc =
function {
    pigment {wrinkles phase .5 // clock
        color_map {[0 color rgb 0][1 color rgb 1]
        }

    turbulence .1
    }
}
isosurface {
    function {
        //sphere
        sqrt(sqr(x) + sqr(y) + sqr(z)) - 1 -
        // y - // the xy plane...
        WrinklesFunc(x, y, z) * WaveDepth
      }
    //contained_by{box <-R,-R/2,-R> <R, R, R>}
    contained_by{sphere <0,0,0> R*2 }


    pigment {rgb <.2 .2 .9 >}
    finish {phong 0.5 phong_size 10}
}


Post a reply to this message

From: Bob H 
Subject: Re: Isosurface 'water' but it goes concave
Date: 8 Jul 2001 01:18:44
Message: <3b47ed34@news.povray.org>
"John D. Gwinner" <jgw### [at] hotmailcom> wrote in message
news:3b4778d1$1@news.povray.org...
>
>   The closest I have so far is an Isosurface, which looks good but when I
> animate it I get something odd: 'phase' identifier in the wrinkles (or waves
> or ripples) causes the surface to move *down* not across, so it causes a
> concavity.  I tried different combinations of functions, rotations, etc. and
> it doesn't seem to work.   An example - I replaced 'clock' in the phase with
> a .5 so you can see what it looks like.

Changed your script code around a little and got a nice little water surface showing
caustics on
the ground below the isosurface.

#version unofficial MegaPov 0.7;

#declare R=1.0;
#declare R1=R+0.01;
#declare Box = 1;

light_source {<50,200,50> colour rgb 1}

camera { location  <5*R, 5*R, -8*R> look_at <0, -1, 0> angle 20}

sky_sphere { pigment {
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

plane {y,-1.5
        pigment {rgb 1}
        finish {diffuse .75}
}

#declare WaveDepth = .5;

#declare WrinklesFunc =
function {
    pigment {ripples phase clock
        color_map {[0 color rgb 0][1 color rgb 1]
        } sine_wave //frequency -1
      scale .5
    turbulence .1
    }
}
isosurface {
    function {
        y-(sqrt(sqr(x) + sqr(y) + sqr(z))// - 1
         - WrinklesFunc(x, y, z) * WaveDepth)/10
    }
   // threshold .1
   // eval
   // accuracy .001
    max_gradient 3
    contained_by{box <-R,-R,-R> <R, R, R>}

 material {
        texture {
    pigment {rgbf <.8, .9, 1, .75 >}
    finish {phong 0.5 phong_size 50
        // reflection .2
         }
        }
        interior {ior 1.3 caustics 1 fade_distance .1 fade_color <.6,.8,1>}
        }
}

I'm not savy enough to know why there is a overall concave surface, as seen when
wrinkles is used
instead of ripples.  Mystery to me, sorry I couldn't solve that.  However the surface
does move in
a way which you wanted I believe.
I animated it with that ripples pattern and it looked right enough to me.  Well, I
take that back,
looks like somethings wrong with the container bounds but I'm not sure.

Bob H.


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurface 'water' but it goes concave
Date: 8 Jul 2001 02:22:02
Message: <uufgGCA8i8R7Ewb7@econym.demon.co.uk>
Wasn't it John D. Gwinner who wrote:
>Folks:
>
>  (modification of post in general)
>
>  I'm trying to figure out the best way to do an aquarium.  I want to show
>the 'ripple pattern' of light moving across the top surface of the water.  I
>want this to be in effect
>a clear block (with an IOR) with a 'wavy' top surface.
>
>  The closest I have so far is an Isosurface, which looks good but when I
>animate it I get something odd: 'phase' identifier in the wrinkles (or waves
>or ripples) causes the surface to move *down* not across, so it causes a
>concavity.  I tried different combinations of functions, rotations, etc. and
>it doesn't seem to work.   An example - I replaced 'clock' in the phase with
>a .5 so you can see what it looks like.
>
>  It's a neat effect but it's not what I'm looking for ;-)
>
>  Any suggestions?

First let me tell you what's happening. The main awkward effect seems to
be that the wrinkles pattern produces values that are centred around
(phase + 0.5). So, when phase is zero you get numbers close to 0.5 which
is in the middle of the colour_map, but when phase is 0.5 you get
numbers that are close to 1.0 which is at the edge of the colour_map
where there's a sharp colour transition.

To see this, forget about the isosurface for a moment, and just paint
the wrinkle pigment onto a sphere

sphere {0,1
    pigment {wrinkles phase 0.5 // clock
        color_map {[0 color rgb 0][1 color rgb 1]
        }

    turbulence .1
    }
}

When the phase is 0.0 you get gentle modulations of grey tones, but when
the phase is 0.5 you get black and white patches, as the numbers fall
off the end of the colour_map.

My rather inelegant fix for this would be to modify the colour_map with
the clock so that the output is centred in mid grey, like this

#declare my_clock = 0;

sphere {0,1
    pigment {ripples  phase my_clock// clock
        color_map {[my_clock-1 color rgb 1]
                   [my_clock   color rgb 0]
                   [my_clock+1 color rgb 1]
        }
    turbulence .1
    }
}


Once the pigment is behaving itself sensibly, we can bung that
colour_map back into the isosurface function

#declare WrinklesFunc =
function {
    pigment {wrinkles phase my_clock // clock
        color_map {[my_clock-1 color rgb 1]
                   [my_clock   color rgb 0]
                   [my_clock+1 color rgb 1]
        }

    turbulence .1
    }
}


A second effect that was happening was that the black/white transitions
caused very sharp gradients in the function, and this exceeded the
default max_gradient. This shouldn't happen any more, but if it does you
can add "method 2 eval" to the isosurface to fix it.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurface 'water' but it goes concave
Date: 8 Jul 2001 03:46:38
Message: <3SJmpDAo7AS7Ewjw@econym.demon.co.uk>
Wasn't it Bob H. who wrote:
>"John D. Gwinner" <jgw### [at] hotmailcom> wrote in message news:3b4778d1$1@news.p
>ovray.org...
>>
>>   The closest I have so far is an Isosurface, which looks good but when I
>> animate it I get something odd: 'phase' identifier in the wrinkles (or waves
>> or ripples) causes the surface to move *down* not across, so it causes a
>> concavity.  I tried different combinations of functions, rotations, etc. and
>> it doesn't seem to work.   An example - I replaced 'clock' in the phase with
>> a .5 so you can see what it looks like.
>
>Changed your script code around a little and got a nice little water surface 
>showing caustics on
>the ground below the isosurface.
>
>
> I'm not savy enough to know why there is a overall concave surface, as
> seen when wrinkles is used instead of ripples.  Mystery to me, sorry I
> couldn't solve that.  However the surface does move in a way which you
> wanted I believe. I animated it with that ripples pattern and it 
> looked right enough to me.  Well, I take that back, looks like 
> something's wrong with the container bounds but I'm not sure.

The concavity is due to subtracting a sphere from the function. You've
got

    function {
        y-(sqrt(sqr(x) + sqr(y) + sqr(z))// - 1
         - WrinklesFunc(x, y, z) * WaveDepth)/10
    }

         which is   plane - (sphere - Wrinkles)/10

The concavity effect looks more pronounced when you use wrinkles because
the ripples are higher than the wrinkles. You can see the underlying
concavity more clearly of you temporarily set the WaveDepth to zero.

If we get rid of the spherical component 

    function {
        y + WrinklesFunc(x, y, z) * WaveDepth/10
    }

         then we get ripples on a flat surface instead of a concave one.

Your fix for the main problem - adding sine_wave to the WrinklesFunc -
declaration also works for the wrinkles pattern, and is rather more
elegant than my shifting of the colour_map in phase with the clock.

Your container looks fine to me.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: John D  Gwinner
Subject: Re: Isosurface 'water' but it goes concave
Date: 8 Jul 2001 12:28:40
Message: <3b488a38$1@news.povray.org>
Mike:

Maybe I'm doing something wrong, but actually, y+WrinklesFunc doesn't work -
it's basically what I tried before (I used y-).  It looks fine as a single
frame, but when you animate it the surface goes down.  I'm posting the
animation in news:news.povray.org/povray.animations  (not sure if that will
work)(Finally in MPEG format, using TMPGE).

I'm including the scene file below your post.  I blended the sine wave and
the color map issues however, might take that out.  I made the wave depth
slightly larger too.

#version unofficial MegaPov 0.7;

#declare R=1.0;
#declare R1=R+0.01;
#declare Box = 1;

camera { location  <5*R, 5*R, -8*R> look_at <0, 0, 0> angle 20}

sky_sphere { pigment {
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

light_source {<100,200,-100> colour rgb 1}
light_source {<-100,200,100> colour rgb 1}


#declare WaveDepth = 1;

#declare WrinklesFunc =
function {
    pigment {wrinkles phase clock
        color_map {
   [ clock-1 color rgb 1]
                   [clock   color rgb 0]
                   [clock+1 color rgb 1]

        } sine_wave //frequency -1
      scale .2
    translate <1, 0, 0>
    turbulence .1
    }
}

isosurface {
    function {
        y + WrinklesFunc(x,z,y) * WaveDepth/10

      }
    contained_by{box <-R,-R,-R> <R, R, R>}


    pigment {rgb <.2 .2 .9 >}
    finish {phong 0.5 phong_size 10}
}





"Mike Williams" <mik### [at] nospamplease> wrote in message
news:3SJ### [at] econymdemoncouk...
> Wasn't it Bob H. who wrote:
> >"John D. Gwinner" <jgw### [at] hotmailcom> wrote in message
news:3b4778d1$1@news.p
> >ovray.org...
> >>
> >>   The closest I have so far is an Isosurface, which looks good but when
I
> >> animate it I get something odd: 'phase' identifier in the wrinkles (or
waves
> >> or ripples) causes the surface to move *down* not across, so it causes
a
> >> concavity.  I tried different combinations of functions, rotations,
etc. and
> >> it doesn't seem to work.   An example - I replaced 'clock' in the phase
with
> >> a .5 so you can see what it looks like.
> >
> >Changed your script code around a little and got a nice little water
surface
> >showing caustics on
> >the ground below the isosurface.
> >
> >
> > I'm not savy enough to know why there is a overall concave surface, as
> > seen when wrinkles is used instead of ripples.  Mystery to me, sorry I
> > couldn't solve that.  However the surface does move in a way which you
> > wanted I believe. I animated it with that ripples pattern and it
> > looked right enough to me.  Well, I take that back, looks like
> > something's wrong with the container bounds but I'm not sure.
>
> The concavity is due to subtracting a sphere from the function. You've
> got
>
>     function {
>         y-(sqrt(sqr(x) + sqr(y) + sqr(z))// - 1
>          - WrinklesFunc(x, y, z) * WaveDepth)/10
>     }
>
>          which is   plane - (sphere - Wrinkles)/10
>
> The concavity effect looks more pronounced when you use wrinkles because
> the ripples are higher than the wrinkles. You can see the underlying
> concavity more clearly of you temporarily set the WaveDepth to zero.
>
> If we get rid of the spherical component
>
>     function {
>         y + WrinklesFunc(x, y, z) * WaveDepth/10
>     }
>
>          then we get ripples on a flat surface instead of a concave one.
>
> Your fix for the main problem - adding sine_wave to the WrinklesFunc -
> declaration also works for the wrinkles pattern, and is rather more
> elegant than my shifting of the colour_map in phase with the clock.
>
> Your container looks fine to me.
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

From: Bob H 
Subject: Re: Isosurface 'water' but it goes concave
Date: 8 Jul 2001 13:50:28
Message: <3b489d64@news.povray.org>
"John D. Gwinner" <jgw### [at] hotmailcom> wrote in message
news:3b488a38$1@news.povray.org...
>
> Maybe I'm doing something wrong, but actually, y+WrinklesFunc doesn't
work -
> it's basically what I tried before (I used y-).  It looks fine as a single
> frame, but when you animate it the surface goes down.  I'm posting the
> animation in news:news.povray.org/povray.animations

Yep, that's curious.  It isn't due to turbulence being used anyway, checked
on that.

Using just the regular color_map as before it undulates up and down.  It is
as if phase effects the color_map or isosurface (or function) in a
unexpected way, as you described.
Although shifting the color_map as it goes might seem a solution I think it
more a bug rather than something to work around.  Maybe someone has more
ideas on this, like whether the behavior is correct or not?  Could it even
be related to the noise clipping?

Btw, the last sample of script had the function x,y,z written as x,z,y this
time so I put it back to x,y,z.

Bob H.


Post a reply to this message

From: John D  Gwinner
Subject: Re: Isosurface 'water' but it goes concave
Date: 9 Jul 2001 09:56:18
Message: <3b49b802$1@news.povray.org>
Ah, thanks - I'd been playing with the functions to see what the effect was
so that's probably where the x,z,y came from.

I didn't think it was a bug exactly, I thought I was doing something wrong
;-)

How would we isolate the bug?

I was wrong about the news link, it's
news:news.povray.org/povray.binaries.animations, "Rot and Renewal".  And now
that I check it, I had the x,z,y *lol*.  Back to the IDE ..

      == John ==



"Bob H." <omn### [at] msncom> wrote in message
news:3b489d64@news.povray.org...
> "John D. Gwinner" <jgw### [at] hotmailcom> wrote in message
> news:3b488a38$1@news.povray.org...
> >
> > Maybe I'm doing something wrong, but actually, y+WrinklesFunc doesn't
> work -
> > it's basically what I tried before (I used y-).  It looks fine as a
single
> > frame, but when you animate it the surface goes down.  I'm posting the
> > animation in news:news.povray.org/povray.animations
>
> Yep, that's curious.  It isn't due to turbulence being used anyway,
checked
> on that.
>
> Using just the regular color_map as before it undulates up and down.  It
is
> as if phase effects the color_map or isosurface (or function) in a
> unexpected way, as you described.
> Although shifting the color_map as it goes might seem a solution I think
it
> more a bug rather than something to work around.  Maybe someone has more
> ideas on this, like whether the behavior is correct or not?  Could it even
> be related to the noise clipping?
>
> Btw, the last sample of script had the function x,y,z written as x,z,y
this
> time so I put it back to x,y,z.
>
> Bob H.
>
>


Post a reply to this message

From: Bob H 
Subject: Re: Isosurface 'water' but it goes concave
Date: 9 Jul 2001 15:53:28
Message: <3b4a0bb8@news.povray.org>
"John D. Gwinner" <jgw### [at] hotmailcom> wrote in message
news:3b49b802$1@news.povray.org...
> Ah, thanks - I'd been playing with the functions to see what the effect
was
> so that's probably where the x,z,y came from.
>
> I didn't think it was a bug exactly, I thought I was doing something wrong
>
> How would we isolate the bug?

Well, being the mere end-user that I am there's not much to try except make
sure the surface level changes along the y axis as a whole instead of just
the pattern changes one would expect.
I put a semitransparent y plane across the isosurface and placed the camera
nearly parallel with it to see if the surface really does rise and fall as a
whole.  It did.  The amount of shift is small but I believe what is
happening is that the function is somehow changing the color_map or isn't
remaining stable.
That is to say, perhaps it brightens and darkens overall instead of only
shifting the color values around in a prespecified range.  If you look at
the patterns themselves you will see the patterns like ripples or bozo (bozo
is especially obvious once animated) transform rgb 0 to rgb 1 while rgb 1
goes to rgb 0 along the pattern wave type.
We can only see the isosurface undulating though to prove or disprove
anything, since the patterns themselves as pigments look correct.
Try the script below if you like, I'm not absolutely certain wrinkles is the
only problemed pattern, granite looks awful when phased.  As Mike Williams
has said it could be all in how the pattern equations are done, something I
know nothing about.  But it looks as though all are subjected to the same
undulation of the isosurface and there isn't anything there I can figure to
cause it aside from phase.

Bob H.

> I was wrong about the news link, it's
> news:news.povray.org/povray.binaries.animations, "Rot and Renewal".  And
now
> that I check it, I had the x,z,y *lol*.  Back to the IDE ..

#version unofficial MegaPov 0.7;

#declare R=1.0;
#declare R1=R+0.01;
#declare Box = 1;

camera { location  <5*R, 0.1*R, -8*R> look_at <0, 0, 0> angle 20}

sky_sphere { pigment {
    gradient y
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
  }
}

plane {y,.05 pigment {rgbf .7}}

light_source {<100,200,-100> colour rgb 1}
light_source {<-100,200,100> colour rgb 1}

plane {y,0
            pigment {wrinkles // bozo // ripples // granite
        color_map {
                   [0   color rgb 0]
                   [1 color rgb 1]

        } sine_wave phase clock
      scale .3
    translate <1, 0, 0>
    turbulence .1
    }
   finish {ambient 1 diffuse 0}
 rotate -90*x
}

#declare WaveDepth = 1;

#declare WrinklesFunc =
function {
    pigment {wrinkles // bozo // ripples // granite
        color_map {
                   [0   color rgb 0]
                   [1 color rgb 1]

        } sine_wave phase clock
      scale .3
    translate <1, 0, 0>
    turbulence .1
    }
}

isosurface {
    function {
        y - WrinklesFunc(x,y,z) * WaveDepth/10

      }
    contained_by{box <-R,-R,-R> <R, R, R>}


    pigment {rgb <.2 .2 .9 >}
    finish {phong 0.5 phong_size 10}
}


Post a reply to this message

From: John D  Gwinner
Subject: Re: Isosurface 'water' but it goes concave
Date: 16 Jul 2001 01:54:44
Message: <3b5281a4$1@news.povray.org>
Well, it turns out the iso surface 'water' works pretty well, but when it's
scaled up to be the surface of my aquarium, the spherical portion makes the
middle look 'lower'.  I could probably fix this, but it's SLOW.

I've basically abandon'd my Isosurface at this point - a procedural
heighfield and Instersection seems to be working much better.  Will post
results later.

       == John ==

"Bob H." <omn### [at] msncom> wrote in message
news:3b4a0bb8@news.povray.org...
> "John D. Gwinner" <jgw### [at] hotmailcom> wrote in message
> news:3b49b802$1@news.povray.org...
> > Ah, thanks - I'd been playing with the functions to see what the effect
> was
> > so that's probably where the x,z,y came from.
> >
> > I didn't think it was a bug exactly, I thought I was doing something
wrong
> >
> > How would we isolate the bug?
>
> Well, being the mere end-user that I am there's not much to try except
make
> sure the surface level changes along the y axis as a whole instead of just
> the pattern changes one would expect.
> I put a semitransparent y plane across the isosurface and placed the
camera
> nearly parallel with it to see if the surface really does rise and fall as
a
> whole.  It did.  The amount of shift is small but I believe what is
> happening is that the function is somehow changing the color_map or isn't
> remaining stable.
> That is to say, perhaps it brightens and darkens overall instead of only
> shifting the color values around in a prespecified range.  If you look at
> the patterns themselves you will see the patterns like ripples or bozo
(bozo
> is especially obvious once animated) transform rgb 0 to rgb 1 while rgb 1
> goes to rgb 0 along the pattern wave type.
> We can only see the isosurface undulating though to prove or disprove
> anything, since the patterns themselves as pigments look correct.
> Try the script below if you like, I'm not absolutely certain wrinkles is
the
> only problemed pattern, granite looks awful when phased.  As Mike Williams
> has said it could be all in how the pattern equations are done, something
I
> know nothing about.  But it looks as though all are subjected to the same
> undulation of the isosurface and there isn't anything there I can figure
to
> cause it aside from phase.
>
> Bob H.
>
> > I was wrong about the news link, it's
> > news:news.povray.org/povray.binaries.animations, "Rot and Renewal".  And
> now
> > that I check it, I had the x,z,y *lol*.  Back to the IDE ..
>
> #version unofficial MegaPov 0.7;
>
> #declare R=1.0;
> #declare R1=R+0.01;
> #declare Box = 1;
>
> camera { location  <5*R, 0.1*R, -8*R> look_at <0, 0, 0> angle 20}
>
> sky_sphere { pigment {
>     gradient y
>     color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
>   }
> }
>
> plane {y,.05 pigment {rgbf .7}}
>
> light_source {<100,200,-100> colour rgb 1}
> light_source {<-100,200,100> colour rgb 1}
>
> plane {y,0
>             pigment {wrinkles // bozo // ripples // granite
>         color_map {
>                    [0   color rgb 0]
>                    [1 color rgb 1]
>
>         } sine_wave phase clock
>       scale .3
>     translate <1, 0, 0>
>     turbulence .1
>     }
>    finish {ambient 1 diffuse 0}
>  rotate -90*x
> }
>
> #declare WaveDepth = 1;
>
> #declare WrinklesFunc =
> function {
>     pigment {wrinkles // bozo // ripples // granite
>         color_map {
>                    [0   color rgb 0]
>                    [1 color rgb 1]
>
>         } sine_wave phase clock
>       scale .3
>     translate <1, 0, 0>
>     turbulence .1
>     }
> }
>
> isosurface {
>     function {
>         y - WrinklesFunc(x,y,z) * WaveDepth/10
>
>       }
>     contained_by{box <-R,-R,-R> <R, R, R>}
>
>
>     pigment {rgb <.2 .2 .9 >}
>     finish {phong 0.5 phong_size 10}
> }
>
>
>


Post a reply to this message

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