Dynamic sNOW SYSTEM/SHADER
Project Brief
Goal of this project was to create a fully dynamic snow system/shader with real-time pathways, snow melting and snow reacting and effecting the environment around. I also was closely referencing Frostpunk and wanted to reacreate some mechanics like central generator and drag and drop system with realtime displacement of the snow.
Render Targets
Generator Render Target

Pathways Render Target

Buildings Render Target

Buildings Masks Atlas

These are the 4 render targets that I generated using a brush material and a blueprint to dictate where exactly the brush material needs to be applied on the render target.



Using the Brush Material which has parameters like Location and Brush Strength exposed I am able to dictate with this blueprint, where exactly and how big of a radius I want. That allows me to paint on to the Render Target in real time and then use these RT within the snow Master Material
Brush Material and Masks Material
Procedural Brush Material

Alpha Mask 2

Alpha Mask 4

Alpha Mask 1

Alpha Mask 3

Alpha Mask 5



Right here I created 2 materials which both function in the exact same way, you have a parameter which determines the size of your texture or procedural mask and a parameter(V3) which is then using player/object position to determine where in the world this Brush gets drawn. All of the parameters are written to within a blueprint Real-Time. Thanks to this I am able to create masks for snow displacement
Snow Shader Master Material
Using the Render Targets


Right here is the fundamental part of the snow shader. Visuals aside this is how I am utilising the render targets to create that Realtime displacements. I have encountered a few issues where displacements would happen at an angle however it was a simple fix by multiplying a Vector 3 (0,0,1).
Normal Maps for the Snow Shader

Normal Maps are pretty simple because I am using a custom texture for the height of the snow hence I do not have to recalculate any normals. I am simply using a tillable snow normal for macro and large detail on the snow.
Shading for the Snow

Most of the work for how snow looks like is done here. Thanks to a tillable snow textures it most of the work is done for me. Base colour is a blueish/white colour which I found online for snow. And then I use a height map to displace the snow from the landscape.
Normal Maps for the Snow Shader

Right here arose one of the first and one of the main problems I have had while doing this project. Because of the project specifications I was limited to using UE 5.2 which had no tessellation or "true" displacement. This meant that I had no way to actually displace the landscape based on a height map. After doing a lot of research I came upon Virtual Height Field Mesh which was the "Experimental" solution Epic has provided. With a lot of bug and problems I got it to work. However, I still had the main problem, my snow had no self-shadowing which completely destroyed the 3D look of the snow. To fix this problem I have sampled both RT and the snow Height Map and converted those to normal maps using Unreals inbuild function "NormalFromHeightMap" this allowed me to fake those shadows I was so sought after, even though it was not a perfect result.
No Shadows (before fix)

With Shadows (after fix)

Snow Sparkles

Final thing for the Snow Shader is snow sparkles, this is just fine detail that you dont always notice but it is nice when you do notice it.
Virtual Height Field Mesh


This is an extreme example of me using Virtual Height Field Mesh. VHFM is the solution Epic provided us for displacement and tessellation. Using Virtual Height Field texture from the landscape and setting the min and max bounds of the VHFM you get a plane which follows landscape shape and the bounds of the landscape. After you can simply create a material as if you were using normal displacement from unreal engine 4. (Top section is the VHFM and landscape is bellow which is untouched)
Real-time Pathways and NPCs
Simple spline setup for showcase purposes

Calls the Blueprint Function to draw the brush

Convert the Brush to Landscape UV space and draws the brush

Macros to determine the size of the brush

Here I break down how I created the real-time pathways. To do this I need a render target and the brush material that I have spoken about earlier. Firstly I took Unreals Manny and created a simple mechanic for the NPC to follow a spline. I decided to not overcomplicate this as it is simply for showcase purpose.
The next thing I did was setup a Blueprint function where I convert the brush material to Landscape UV Space thanks to this I could avoid using a Ray-cast which saves performance. Also based on the nature of the project I do not have any changes in height which means that I dont have to worry about the snow displacement at different height-levels.
Lastly all I did was call that Blueprint Function and spawn in along the spline with NPC using a timeline and it would automatically draw a path on the Render Target which is inside of the Snow MM
Generator ON Snow melting
Snow Melting around the generator and grass melting

Working the same way as Real-time pathways and the same logic I take the Brush size and scale it using a timeline within the Blueprint. Also with snow melting the grass frost also melts. I exposed the parameter inside of the landscape MM which controlled how much frost there is on the grass and using the same timeline that I used for snow melting I am able to reduce the amount of frost real time boosting the effect even further.
Generator OFF Snow reaccumulating
Snow Reaccumulating and Frost

When the player turns off the generator the first thing that happens is the the frost slowly covers the grass. After I clear the have another parameter exposed which controls the displacement of the generator Render Target and using a timeline, overtime the snow reaccumulates. I also use the same blueprint to reaccumulate snow in the pathways which happens independently to the generator.
Drag and Drop System (Frostpunk) Inspired
User Widget setup/UI

Stop Placing the building

This is my setup for the User Widget. Originally I had a tooltip show-up explaining what to do when the game starts however I scrapped that later on. I also had to play around a lot with when exactly the house is placed, because orginialy snow would displace around the button you pressed not on the house that has been placed in another position.
Close up of Drag and Drop setup

Close up of Drag and Drop setup

Building setup

Drag and Drop setup

This is a setup for the drag and drop system that I used. Upon clicking it spawns a building on cursor and once you click again and then the snow gets displaced.
Also the setup for actual buildings is pretty much the same as the pathways. The only thing that is different is the textures. I use custom made Alpha Masks. They were all originally rotated correctly so I did not have to worry about rotating them inside of the shader




These are the 4 masks that I have used for the houses. They were all made inside of Photoshop to match each custom house exactly