Shader Guide for UE4

Kurt Kupser was kind enough to share with 80.lv readers a very detailed instruction on how to set up great material snow shaders.

Kurt Kupser was kind enough to share with 80.lv readers a very detailed instruction on how to set up great material snow shaders.

Hello, my name is Kurt Kupser. I am currently a senior environment artist at The Coalition. I am also an instructor at CG Master Academy, and I am teaching a class focused on creating shaders for your assets in Unreal Engine 4. This 6 week course will cover creating master materials for all types of assets and environments, ranging from rocks and ground surfaces, to hard surface sci-fi props.

I wanted to give you a sneak peak of my upcoming course and go over how to add snow to your assets based on the world space up vector direction. For this demonstration, I am using a rock from Quixel’s Megascans library. 

1 of 2

 

I created a snow blending material function that i can re-use in any material I make. (For more info on the basics of material functions, check out this article here) I input the material attributes, and plug in some parameters to controls things such as the tiling, coverage and height of the snow.

Here is what the mask portion of the material function looks like:

Step one: Masking out the up vector in world space

First, we want to drop in a vector 3, with an RGB value of 0,0,1 (a flat normal colour) and use the transform vector node to convert it to world space. Then we can use a component mask to isolate the portion of the mesh that points upwards in world space.

Step two: Adding the normal map

Next, we want to add the surface detail of the normal map to add some micro breakup to our mask. This additional detail will make the buildup of the snow feel more accurate. Input your normal map, and convert it from tangent space to world space using a transform vector node. Normalize the map, then use a component mask to isolate the blue channel, same as we did last step. Finally, run that result into an absolute node (abs). This converts any negative numbers into positive ones by simply dropping the minus sign. We need to do this because to prevent any wonkyness when we multiply the up vector from the previous step with our normal map. The parts of the mesh that are facing down actually having negative values, when we multiply those negative values together, the change to positive and end up adding to the mask. By changing one of our multiplication inputs to positive, the downward facing parts of the mesh stay below 0.

Step three: Adding a coverage parameter

Now we want to simply add a multiply parameter to increase the buildup of the snow and clamp the result down between 0 and 1.

Step 4: Adding vert paint control

This part is fairly straightforward. We just want to select a vertex paint channel to multiply onto the mask. This gives us extra control if we want to remove snow from specific parts of the mesh once we’ve placed it in the level.

Step five: Adding contrast

I like to add as contrast parameter to control the tightness of the blend mask. This allows us to get a softer blend between snow and our underlying surface, or we get push the contrast up to get a more binary look.

Step six: Adding a breakup mask

Finally, we want to add a breakup mask that blends down onto our mesh. This gives some organic breakup across the surface and makes the snow buildup feel more natural and. In this case, I am using the AO map, and a power parameter to tighten up the AO and overlay it on the snow mask. I chose to overlay the breakup mask so once the the snow coverage gets to a white value, the breakup map is no longer being applied to the snow mask. This allows me to really push the snow coverage to high values and get a fully covered snowy surface, but while the coverage is low, the breakup mask is applied.

Additional tip:

Sometimes it helps to be able to visualize your snow mask in 3D space in your viewport. I like to add a switch that inputs the black and white snow mask into the albedo slot.

Make a static switch, and input a boolean parameter for the switch value. Feed the snow mask into the true input, and your albedo into the false input. Now, when you set the value of the boolean to true in your material, the snow mask will appear as your albedo.

That’s it for now! If you have any questions, feel free to email me at kupser.k@gmail.com

To learn more details about the class and view the class outline, check out the CGMA page!

To see more of my work, check out my portfolio here.

Kurt Kupser, Senior Environment Artist at The Coalition

Join discussion

Comments 2

  • Crumpler Clinton

    This is awesome Kurt!

    0

    Crumpler Clinton

    ·6 years ago·
  • macoll

    Super article and thanks for the tips  ;)

    0

    macoll

    ·6 years ago·

You might also like

We need your consent

We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more