Ripple Water Surface Animator
Posted: Wed Jan 14, 2004 9:49 pm
Here is my first attempt at a water surface that ripples as if rain were falling on it. In the demo I have a high poly water surface so it may be slow if you have an older card. On mine I get about 70fps. I have packed up the demo (based on my ping code) so you can see it in action. Separately I packed up the source and samplecode for you to insert this in your project.
The SceneNodeAnimatorRipple takes a mesh to work on. It makes two arrays of floats to handle the ripple height (previous and current) - this is a bit memory intensive - i am wondering if i could get away with shorts instead or smaller ripple arrays that could overlap (almost like a surface particle system). The cool thing about having the whole surface as an array is that i could add waves and other perturbations of the water surface and they would all work out over time.
right now the animator paces itself to update every 80 milliseconds - its hardcoded in - i could expose it in the constructor but i would rather wait until the next irrlicht release and do something better with time management of animators overall - i think it would be good to have a timeslice manager that triggered these at set intervals rather than each animator doing a time test internally and being called every frame
well, here is the screenshot that sucks - only one ripple in the lower right - it looks MUCH better in action (if you take a better screenshot post it - ripples are hard to catch in action)
the runtime app can be found here:
http://www.ping.net/snapshots/ripple1.zip
and the sourcecode for the ripple animator is at
http://www.ping.net/snapshots/ripplecode1.zip
The SceneNodeAnimatorRipple takes a mesh to work on. It makes two arrays of floats to handle the ripple height (previous and current) - this is a bit memory intensive - i am wondering if i could get away with shorts instead or smaller ripple arrays that could overlap (almost like a surface particle system). The cool thing about having the whole surface as an array is that i could add waves and other perturbations of the water surface and they would all work out over time.
right now the animator paces itself to update every 80 milliseconds - its hardcoded in - i could expose it in the constructor but i would rather wait until the next irrlicht release and do something better with time management of animators overall - i think it would be good to have a timeslice manager that triggered these at set intervals rather than each animator doing a time test internally and being called every frame
well, here is the screenshot that sucks - only one ripple in the lower right - it looks MUCH better in action (if you take a better screenshot post it - ripples are hard to catch in action)
the runtime app can be found here:
http://www.ping.net/snapshots/ripple1.zip
and the sourcecode for the ripple animator is at
http://www.ping.net/snapshots/ripplecode1.zip