Jean-Marc Le Roux Web, RIAs and chocolate spaghettis…

9Feb/121

Minko ShaderLab: Waves Simulation On The GPU with Flash

Alexandre Cyprien - one of Aerys' engineers - trained himself on the Minko ShaderLab with quite a challenge: waves simulation on the GPU! Alexandre is doing a very extensive work on 3D compression and Artificial Intelligence algorithms. He is not a GPU programmer so I'm very happy he was able to create such a cool and complex effect in no time with the ShaderLab! He took his inspiration from the GPU Gem Article: Effective Water Simulation from Physical Models. Here are the results:

There is not a single line of ActionScript here: everything is done on the GPU! Even the little embed above was created using the "share" feature of the ShaderLab I already detailed in a previous post.

You can actually embed it on your own page/blog with the following HTML code:

<iframe src="http://shaderlab.aerys.in/view?url=http://shaderlab.aerys.in/samples/Circular%20And%20Directional%20Waves%20v2.mks"
        width="640"
        height="360">
</iframe>


This example is actually a combination of multiple waves with different amplitudes and speed. It mixes both directional and circular waves:

Creating and blending multiple waves was actually fairly easy with the ShaderLab: Alexandre used the macro creation feature of the ShaderLab to create new custom "Wave" and "Wave Normal" operations. The important thing to remember here is that the ShaderLab does not provide such operations: Alexandre was able to create them using basic maths functions. Now it is done, those high level nodes can be shared used by anyone and you can easily add waves in any material! It clearly demonstrates how easy it is to add new features to Minko's ShaderLab.

Those nodes accept various inputs detailed in the GPU Gem article. The waves are then blended with the "Add" operation. You can see how the "Wave" and "Wave Normal" nodes can be used in the ShaderLab:

The "Wave" node can also accept inputs from the "Sound" node in order to synchronize (some of) the waves with the sound spectrum. If you haven't seen what the ShaderLab is capable of, you can watch the following video:

Comments (1) Trackbacks (2)
  1. Really impresssive your tool :)


Leave a comment

(required)