POV-Ray : Newsgroups : povray.binaries.images : height_field animation problem : Re: height_field animation problem Server Time
5 Nov 2024 00:26:19 EST (-0500)
  Re: height_field animation problem  
From: Chris B
Date: 26 Dec 2005 09:02:40
Message: <43aff800$1@news.povray.org>
"Tom33" <ths### [at] gmxde> wrote in message 
news:web.43af075227adceaf445e54810@news.povray.org...
> "Tom33" <ths### [at] gmxde> wrote:
>> Hi,
>>
>> I have a problem with a height_field :
>>
>> I have made a flag in the wind for an still picture with a height_field 
>> and
>> it looks like ok for me, but now i have to animate the waves of the
>> height_field image_map ! Is this possible ??
>>
>> Thanks
>> Tom33
>
> Sorry, i will not animate the image_map !! I will animate the height_field
> map to simulate wind ;o)
>

Hi Tom,
Yes this is possible.

Two methods spring to mind.

1) Cut and paste a second copy of the image to the right of the first and 
smooth out the join, then use clipped_by or CSG to take half the height 
field, starting with the left half and moving right until you reach the 
right hand edge as the clock moves from 0 to 1. Then when you create an 
animation loop it should look seamless. Clearly you'll need to scale the 
helf of the height field you use to the size of your flag.

2) Use a function for the height field rather than an image and rotate the 
pattern so that it returns to the same spot at the end of the animation 
cycle.

The following example illustrates the second method. I've used bumps and 
scaled them to give a more ripple-like effect, then rotated the bump pattern 
around the origin based on the clock value. The height field then uses the 
function, taking samples of the pattern at a point about 0.5 units above the 
x axis. As the pattern rotates frame by frame it gives the impression that 
the ripples are moving through the surface.

p.s. Because the first and last frame are in the same place you'll need to 
delete one or other of them to get a smooth animation cycle (or adjust the 
rotation so it doesn't make it all the way back to the start position).

Happy New Year,
Chris B.

light_source { < -150, 80  ,-8> color rgb 1}
camera {location <-0.1,1,-1> look_at <0.5,0.5,0>}

#declare MyFuntion = function {
  pattern { bumps scale <0.15,0.3,0.15> rotate y*clock*360}
}
#declare MyIntensity = 0.08;

height_field {
  function 400, 400 { MyFuntion(x, y+1, 0.5)*MyIntensity + 0.5 }
  smooth
  pigment {color rgb <1,1,1>}
}


Post a reply to this message

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