POV-Ray : Newsgroups : povray.general : Creating a ripple effect Server Time
4 Aug 2024 18:17:06 EDT (-0400)
  Creating a ripple effect (Message 1 to 8 of 8)  
From: DL
Subject: Creating a ripple effect
Date: 21 Feb 2003 02:42:59
Message: <3e55d883@news.povray.org>
How can I create ripple effect like when a helicopter is flying above a
water surface?  I could use the "ripples" pattern but I don't want the whole
water surface to become rippled.  I want the ripples to gradually fade away
from the center.  I also don't want the ripples to originate exactly from
the center because that is not realistic when a helicopter is flying
overhead.  The ripples should around the perimeter of the helicopter.


Post a reply to this message

From: Sir Charles W  Shults III
Subject: Re: Creating a ripple effect
Date: 21 Feb 2003 03:41:26
Message: <3e55e636$1@news.povray.org>
Check out this java applet and you can swipe some code from it.  Surely this
can be adapted to a surface normal routine!

http://www.visionariamedia.org/java/java.htm

Cheers!

Chip Shults
My robotics, space and CGI web page - http://home.cfl.rr.com/aichip


Post a reply to this message

From: Mark Weyer
Subject: Re: Creating a ripple effect
Date: 21 Feb 2003 04:57:56
Message: <3E55FB1A.4000802@informatik.uni-freiburg.de>
> How can I create ripple effect like when a helicopter is flying above a
> water surface?  I could use the "ripples" pattern but I don't want the whole
> water surface to become rippled.  I want the ripples to gradually fade away
> from the center.  I also don't want the ripples to originate exactly from
> the center because that is not realistic when a helicopter is flying
> overhead.  The ripples should around the perimeter of the helicopter.

There are two approaches I know of: Normals and isosurfaces.
I am usually not satisfied with normals.
My approach would be to make the water an isosurface. The isosurface
function would be a sum of elementary ripples. One elementary ripple
has the form

   sin(sqrt(pow(x-center_x,2)+pow(y-center_y,2))*2*pi/wavelength+phase)*amplitude

or, if the ripples should be parallel (e.g. those that are there even
if the helicopter is not),

   sin((x*dx+y*dy)*2*pi/wavelength+phase)*amplitude

where (dx,dy) is the direction of the wave movement.
The whole isosurface function would be

   ripple_1(x,y)+...+ripple_n(x,y)+z

I assume here that z is up.
If this is for an animation, choose

   phase=phase_0-clock*speed*2*pi/wavelength

The speed of all elementary waves should be equal.
If you want to turn that into a normal pattern (for render speed that
would be), the normal is the gradient of the isosurface function, i.e.

   cos(sqrt(pow(x-center_x,2)+pow(y-center_y,2))*2*pi/wavelength+phase) *
   vnormalize(x-center_x,y-center_y,0)*2*pi/wavelength * amplitude

   cos((x*dx+y*dy)*2*pi/wavelength+phase) * (dx,dy,0) * amplitude

   normal_1(x,y)+...normal_n(x,y)+(0,0,1)



-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: ABX
Subject: Re: Creating a ripple effect
Date: 21 Feb 2003 05:15:17
Message: <6rub5v0r4c8664lj13e41cpvsk033ohjgj@4ax.com>
On Fri, 21 Feb 2003 11:10:34 +0100, Mark Weyer
<wey### [at] informatikuni-freiburgde> wrote:
> My approach would be to make the water an isosurface

http://www-public.tu-bs.de:8080/~y0013390/pov/water/

ABX


Post a reply to this message

From: hughes, b 
Subject: Re: Creating a ripple effect
Date: 21 Feb 2003 06:27:53
Message: <3e560d39@news.povray.org>
"DL" <dav### [at] hotmailcom> wrote in message
news:3e55d883@news.povray.org...
> How can I create ripple effect like when a helicopter is flying above a
> water surface?  I could use the "ripples" pattern but I don't want the
whole
> water surface to become rippled.  I want the ripples to gradually fade
away
> from the center.  I also don't want the ripples to originate exactly from
> the center because that is not realistic when a helicopter is flying
> overhead.  The ripples should around the perimeter of the helicopter.

Okay. This is what I'd do...

global_settings {
    number_of_waves 5
}

#declare S=0.09; // ripples scaling
#declare N0=normal {ripples 0}
#declare N1=normal {ripples 0.9
    phase -clock*3 // spread outward when animated
  turbulence 0.3 scale S}
#declare N2=normal {ripples 0.3
    phase -clock*3 // spread outward when animated
  turbulence 0.9 scale S/1.5}

plane {y,0
 pigment {rgb 1}
normal {
    spherical
        normal_map {
[0 N0] // this is the outermost edge
[1/6 N2] // less wavy water
[1/2 N1] // more wavy water
[2/3 N2] // less wavy water
[1 N0] // this is the center
        }
scale 2 // adjust overall size here
}
 finish {specular .5}
}

You could also make a pigment to match this by following the same principal,
if you needed frothing water for example.
Maybe I'm giving too simple an answer but then that's about all I'm good
for.
--
Farewell,
Bob


Post a reply to this message

From: Mark Weyer
Subject: Re: Creating a ripple effect
Date: 21 Feb 2003 06:33:02
Message: <3E561163.6050309@informatik.uni-freiburg.de>
> My approach would be to make the water an isosurface. The isosurface
> function would be a sum of elementary ripples. One elementary ripple
> has the form
>   
> sin(sqrt(pow(x-center_x,2)+pow(y-center_y,2))*2*pi/wavelength+phase)*amplitude 

This formula for central ripples did not take perishing into account.
Here is a corrected version:

   sin(r*2*pi/wavelength+phase)*amplitude/r

where r is the distance from the center and the amplitude is at r=1.
Ideally we would have

   r=sqrt(pow(x-center_x,2)+pow(y-center_y,2))

However this would be unrealistic for small r (It would be like
causing a wave by pushing water up with a needle 1km long and
1mm thick.). Hence a correction:

   r=sqrt(pow(x-center_x,2)+pow(y-center_y,2)+pow(r_0,2))

For the gradient this turns to:

   cos(r*2*pi/wavelength+phase)*amplitude/r*2*pi/wavelength*dr -
   sin(r*2*pi/wavelength+phase)*amplitude/pow(r,2)*dr

where

   dr=<x-center_x,y-center_y,0>/r

> or, if the ripples should be parallel (e.g. those that are there even
> if the helicopter is not),

As ABX has pointed out, there are more elaborate solutions
for this in Christoph Hormann's tutorial. However, the gradient
I gave you for this case was wrong. It should be

   cos((x*dx+y*dy)*2*pi/wavelength+phase)*amplitude*2*pi/wavelength*<dx,dy,0>

Hope I got it right this time ;-)


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: DL
Subject: Re: Creating a ripple effect
Date: 26 Feb 2003 01:21:53
Message: <3e5c5d01$1@news.povray.org>
>    r=sqrt(pow(x-center_x,2)+pow(y-center_y,2)+pow(r_0,2))

What is r_0?


Post a reply to this message

From: Mark Weyer
Subject: Re: Creating a ripple effect
Date: 3 Mar 2003 05:58:20
Message: <3E633857.2080805@informatik.uni-freiburg.de>
>>   r=sqrt(pow(x-center_x,2)+pow(y-center_y,2)+pow(r_0,2))
> 
> What is r_0?

1. Technically we have a 3D-wave that is centered at
    (center_x, center_y, r_0). Of this wave we take only
    the slice with z=0.

2. Before the correction, amplitude has been the height (or half
    of the height) of the wave. Now the height varies, being
    maximal at (center_x, center_y). Its value there is
    amplitude/r_0.
    On the other hand r_0 determines how fast the wave diminishes.
    Let us say you want to specify the height of the wave (at the
    center) and the distance from the center at which the height
    is halfed. Then choose

    r_0 = distance/sqrt(3)
    amplitude = height*r_0

Hope i got it right

-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

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