POV-Ray : Newsgroups : povray.general : Creating a ripple effect : Re: Creating a ripple effect Server Time
5 Nov 2024 18:26:42 EST (-0500)
  Re: Creating a ripple effect  
From: Mark Weyer
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

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