This page looks best with JavaScript enabled

Accumulating Snow - Dynamic Snow in Unity - Part 3

 ·   ·  ☕ 2 min read

We’ve already built a snow shader that can deform as you walk over it. But what about recovering over time? We’re going to solve that problem here using a compute shader to automatically replenish our snow over time. The current implementation replaces snow at a rapid pace, simulating fantasy blizzard like conditions however we can tweak that over time.

To accomplish this we’ll use a double buffering method of writing to one texture and displaying the other and switching between which does which every frame. This allows us to save the current state of things and build the new state simultaneously (and hopefully also addresses some of the issues people encountered with the grass implementation).

Once we have validated that our compute shader is correct and that our buffer is working we can update our function to slowly replenish snow in depressed areas. Effectively giving the effect of the paths filling back in over time.

Featuring special guest: Cortana. She was really excited to join us even though nobody asked her to.

Unity’s documentation on compute shaders can be found here:

Want to learn more about Compute Shaders? Here’s a quick introduction to them:

We’ve also used Compute Shaders in our Grass simulation. More on that here:

Join the World of Zero Discord channel:

Sam Wronski
Sam Wronski
Maker of things and professional software engineer. Lets make something awesome together!