If I sample a point above, below, left, and right of a point of displacement on a grid, I can get a decent water ripple…
Can any of you give me some code to get a better ripple (not a sqare). I know I should sample more points and weight (whatever that means) them differently, but my grid always blows up if i sample more than 4.
I’ve seen some demos with pretty nice circular ripples…
I was hoping for this “weighting” code snippet…
Calculate the distance from the center of the ripples for each grid point and take this distance to calculate the offset in height with a damped sinus.
Take into account the diagonals and weight them less, the top/bottom/left/right points should be weighted slightly more and the centre point should be weighted the most. weighting is like A.A of a pixel, the centre is full brightness the ends are a little dimmer/transparent and the diagonals are very faint. when you take into account more points are you dividing by the larger number of sample points to make sure you are getting the correct average. To do weighting multiply the central point by say 3 and ends (top,left etc.) by 2 and then calculate the average (making sure you divide the sum by the correct number to take into account the multiples). the exact values are up to you and will depend on your situation.
Oh yea I have thought of this on the spot so if any of it is wrong then don’t blame me but it sounds ok (to me ).