Cloudy planet breakdown, part 6

Our final step adds the real magic sauce: Simulating both wind and coriolis effects. Both of these will be done via shameless cheats.

In fact, we are not going to simulate the physics at all. Instead, we are just going to simulate the appearance of wind and coriolis effects.

We do this by adding just two lines to our shader code:

   T.z += .1 * uTime;    // MOVING TEXTURE FAKES WIND.
   T.y += noise(.5 * P); // UP/DOWN MOTION FAKES CORIOLIS.

The first line of code simply slides the entire texture perpendicular to the screen. This has the effect of creating smooth yet unpredictable changes over time — exactly the visual impression we would get from wind forces across the planet surface.

The second line of code makes different parts of the texture travel up and down in latitude as the texture slides past the planet. The wispy cloud texture flows upward in some places, while flowing downward in other places — exactly the visual impression we would get from coriolis forces across the planet surface.

We have now rebuilt the complete cloud-roiled planet texture, step by step. The code looks slightly different from the original code, but it does exactly the same thing. You can see the live animation, together with the editable code that generates it, by CLICKING HERE.

Leave a Reply

Your email address will not be published. Required fields are marked *