Spring Dampening
I set up a wave simulation using something I saw on here once. Basically the vertical acceleration of a vertex in a height field is proportional to the weighted average height of vertices near it. So basically the acceleration is -kx where x is the displacement from the average height. The k affects how fast the wave propogates as well as the vertical acceleration of the vertex. I use a convolution matrix (filter) to calculate the weighted average height. I''ve found the size of that filter determines the wave length. The filter I use gives a weight equal to the inverse square of the distance from the center. That makes the center division by zero so I assign an arbitrary values there. The value I use in the center has some impact on the dampening. I can also dampen it by setting the total of all the elements of the filter to less than one.
It seems there should be a way to dampen a single vertex without regard to any other vertex. It also seems like the dampen factor should be of the form C1-C2*e^(-kx^2) where TV is a terminal velocity. I can''t figure out how to actually work that in. Any suggestions on how to actually work that in or alternatives on dampening a vertex? Also is there any way to increase the wave length without increasing the size of the filter?
Does this sound reasonable? If dv is the change in velocity calculated for the frame based on displacement, v is the velocity at the start of the frame and tv is a terminal velocity then ndv=dv*(tv-|v|)/tv where net change in velocity. When the velocity is zero the multiplier is one and when the velocity is the +/- the terminal velocity the multiplier is zero.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement