Friday, 15 April 2011

Wave Modifier



Spurned on by the success of my first Away3D 4.0 Experiment and what with it being friday afternoon, I thought I'd try another one.
After looking at the docs (I know, cheating really) I tried making a wave modifier.
Considering the maths is all on the CPU it runs quite well. There is massive room for optimisation by making the wave function run as a GPU program. Maybe something for next friday...

Looking at the code it might look complicated, but that's just me over-engineering the demo. The interesting bit is "incrementWave" that basically moves all vertices in the Z plane using a sign function, depending on their x and y positions.

"Change Image" gives you a grid pattern so you can see the wave more clearly.

No comments:

Post a Comment