Creating a snowy mountain landscape with procedurals

In this recipe, we will make a snowy mountain landscape by reusing existing shaders—the Rock_procedural and the Snow materials. We will improve these materials by grouping them and exposing the useful values. Then we will create a new group node that will work as a stencil to depict snow in a more customizable and natural way on the rocks as shown in the following screenshot:

Creating a snowy mountain landscape with procedurals

The snowy mountain landscape as it appears in the final rendering

Getting ready

As usual, let's start with the preparation of the scene. In this case, we start with an almost ready blend file:

  1. Start Blender and open the 9931OS_05_RockSnow_start.blend file, where there is a scene with a placed Camera—a simply modeled Mountain object and a Plane set as Emitter.
  2. Select the Mountain object, go to the Object modifiers window, and assign a Subdivision Surface modifier. Set the levels to 2 for both View and Render.
  3. Assign a second Subdivision Surface modifier. Set the levels to 1 for both View and Render.
  4. Assign a Displace modifier. Click on the Show texture in texture tab to the extreme right of the Texture name slot to go to the Textures window. Assign a Voronoi procedural texture. Set the Size to 1.00. Go back to the Displace modifier and set the Strength to -0.200.
  5. Assign a second Displace modifier. In the Texture window, assign a new Voronoi Texture and set Distance Metric to Manhattan and Size to 0.50. Back in the Displace modifier panel, set the Strength to -0.050.
  6. Assign a third Displace modifier, select a Clouds texture, and set Noise to Hard and the Displace modifier's Strength to 0.040.
  7. Assign a fourth Displace modifier. In the Texture window, assign a Musgrave procedural texture. Set the Type to Hetero Terrain, Dimension to 0.650, Lacunarity to 2.000, Octaves to 0.500, Offset to 0.250, Basis to Voronoi F1, and Size to 2.00. Back in the Displace modifier panel, set the Strength to 0.300.
  8. Assign a fifth Displace modifier. In the Texture window, assign a Distorted Noise texture. Set the Noise Distortion to Voronoi F1, Basis to Improved Perlin, Distortion to 2.000, and Size to 3.30. Back in the Displace modifier panel, set the Strength to 0.100 as shown in the following screenshot:
    Getting ready

    The mountain object obtained using different settings—without and with the several modifiers

  9. Now disable the Display modifier in viewport button (the eye icon) of each modifier.
  10. Go to the World window and click on the Use Nodes button. Then click on the little square with a dot on the right side of the Color slot. From the pop-up menu, select Sky Texture. On the Background node, set the Strength value to 1.200.
  11. Add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader) and paste it between the Background and the World Output nodes. Switch the link of the Background node with the second input socket.
  12. Add a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate), a Mapping node (press Shift + A and navigate to Vector | Mapping), an Environment Texture node (press Shift + A and navigate to Texture | Environment Texture), and a new Background node (press Shift + A and navigate to Shader | Background).
  13. Connect the Generated output of the Texture Coordinate node to the Vector input socket of the Mapping node, and the output of this node to the Vector input socket of the Environment Texture node. Connect the Color output of this node to the Color input socket of the second Background node.
  14. Connect the output of the second Background node to the first input socket of the Mix Shader node, and set its Strength to 0.250. Add a Light Path node (press Shift + A and navigate to Input | Light Path). Connect the Is Camera Ray output to the Fac input socket of the Mix Shader node.
  15. Go to the Environment Texture node and click on the Open button. Browse to the texture folder and load the WinterForest_Env.hdr image (it's a free, high-dynamic-range image downloaded from the sIBL Archive at http://www.hdrlabs.com/sibl/archive.html, and licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License).
  16. Go to the Mapping node and set the Rotation value of Z to 19° as shown in the following screenshot:
    Getting ready

    The World network setting

  17. Go to the Render window, and under the Sampling subpanel, set both the Clamp Direct and Clamp Indirect values to 1.00. Set the Samples to 10 for Preview and 25 for Render. Under the Light Paths subpanel, disable both the Reflective Caustics and Refractive Caustics items and set the Filter Glossy to 1.00.

How to do it...

We are going to create the scene and materials by dividing the process into four stages:

  • Appending and grouping rock and snow shaders
  • Mixing the material groups
  • Creating a stencil shader
  • Adding an atmospheric perspective

So, let's start with the first stage.

Appending and grouping the rock and the snow shader

Let's append the required (and previously made) materials, and group them for convenience:

  1. From the 9931OS_03_snow.blend file, append the Snow_01 material, and for now, assign it to the Mountain object.
  2. In the Node Editor window, select all the nodes except Texture Coordinates and Material Output, and press Ctrl + G to group them.
  3. Place the SNOW_COLOR frame to the right of the SNOW_BUMP frame. Select the Group Output node, and in the (press N) Properties panel of the Node Editor window, delete the Value output.
  4. Add a Bump node (press Shift + A and navigate to Vector | Bump). Connect the Value output of the Math04 node inside the SNOW_BUMP frame to the Height input socket of the Bump node. Then connect the Normal output of the Bump node to the Normal input sockets of the Diffuse BSDF, Glossy BSDF, and Translucent BSDF shaders inside the SNOW_COLOR frame.
  5. Click on the Strength socket of the Bump node and drag it into the empty socket on the Group Input node. Rename the socket (automatically named Strength) as Bump_Strength. Repeat this step for the Distance socket and rename it as Bump_Distance.
  6. Drag the Color input socket of the Diffuse BSDF node into the empty socket of the Group Input node. Move the new socket to the top of the list and rename it as Snow_Color. Drag the Color input of the Glossy BSDF shader node and connect it to the same Snow_Color socket.
  7. Drag the Color input socket of the Translucent BSDF node into the empty socket of the Group Input node. Move the new socket upwards, just below the Snow_Color socket, and rename it as Transl_Color.
  8. Move the Vector socket on the Group Input node to the bottom of the list, and close the group. Rename it as Snow_02 and check the fake user option. Click on the Bump_Strength slider and type 1.500 as shown in the following screenshot:
    Appending and grouping the rock and the snow shader

    Making a node group of the appended snow material

  9. From the 9931OS_03_Rock_procedurals.blend file, append the Rock_proc01 material. Go to the Material datablock button on the Node Editor toolbar and assign it to the Mountain object.
  10. In the Node Editor window, select all the nodes except the Texture Coordinates and the Material Output nodes. Press Ctrl + G to group them. Set the Location values in the Mapping node to 0.000 for all the three axes.
  11. Add a Math node (press Shift + A and navigate to Converter | Math). Set the Operation to Multiply and the first Value to 1.000. Press Shift + D to duplicate it, and do this three times. Connect the Value outputs of each of the four Multiply-Math nodes to the Scale input sockets of the four Noise Texture nodes inside the BUMP frame.
  12. Now, in the second Value slot of each Multiply-Math node, set 10.000 for Noise Texture01, 15.000 for Noise Texture02, 37.500 for Noise Texture03, and 112.500 for Noise Texture04.
  13. Add a Voronoi Texture node (press Shift + A and navigate to Texture | Voronoi Texture), switch the Coloring to Cells, and connect its Fac output to the first Value input socket (the socket with value of 1.000) of each of the four Multiply-Math nodes.
  14. Connect the Voronoi Texture node's Vector input socket to the Vector output of the Mapping node and drag the link from its Scale input socket to the empty socket of the Group Input node. Rename the new socket as Rock_Scale as shown in the following screenshot:
    Appending and grouping the rock and the snow shader

    Adding Math nodes to tweak the exposed scale values of the textures for the procedural rock material

  15. Now go to the COLOR frame and delete the RGB node. Then select the Mix03 node and press Ctrl + X to delete it, maintaining the connection of the Darken node to the Color2 socket of the Add node.
  16. Add a MixRGB node (press Shift + A and navigate to Color | MixRGB), label it as Mix03 again, and paste it between the RGB Curves node and the Diffuse BSDF shader. Set the Blend Type to Color and connect its output to the Color input socket of the Glossy BSDF shader.
  17. Press Shift + D to duplicate the Mix03 node. Label the duplicate as Mix04 and paste it between the RGB Curves and the Mix03 nodes. Set its Blend Type to Multiply and the Color2 to pure black. Then select both the Mix03 and Mix04 nodes and parent them to the COLOR frame as shown in the following screenshot:
    Appending and grouping the rock and the snow shader

    Adding color variations to the rock material

  18. Click on the Color2 input socket of the Mix03 node. Drag it to the empty socket of the Group Input node. Move the new socket to the top of the list and rename it as Rock_Color.
  19. Repeat the preceding step with the Fac socket of the Mix04 node, and rename the new socket as Rock_Darkness. Move the Vector socket on the Group Input node to the bottom of the list.
  20. Add a new MixRGB node (press Shift + A and navigate to Color | MixRGB) and a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp). Connect the Color output of the Mix03 node to the Color1 input socket of the new MixRGB node, and the Color output of Mix01 to the Color2 input socket.
  21. Connect the Color output of the new MixRGB node to the Fac input socket of the ColorRamp node. Then connect the Color output of this node to the empty socket of the Group Output node. Go to ColorRamp and set the position of the black color stop to 0.500 and the position of the white color stop to 0.545 as shown in the following screenshot:
    Appending and grouping the rock and the snow shader

    Creating a Color output in the node group to be used later to detail the stencil effect

  22. Drag the Strength and the Distance sockets of the Bump node to the Group Input node, and rename them as Bump_Strength and Bump_Distance, respectively. Move the Vector socket to the bottom. Press Tab to exit Edit Mode.
  23. Rename the group as Rock_proc_02, and enable the fake user. Set the Rock_Color values for R 0.078, G to 0.067, and B to 0.056; the Rock_Scale to 0.600; and the Rock_Darkness to 0.469 as shown in the following screenshot:
    Appending and grouping the rock and the snow shader

    The overall view of the procedural rock node group in Edit Mode

Mixing the material groups

Now we can start to build the real shader by mixing the procedural rock and snow materials:

  1. Press Shift + A with the mouse in the Node Editor window and add the Snow_02 group node (press Shift + A and navigate to Group | Snow_02). Then rename the material as Rock_Snow in the Node Editor toolbar.
  2. Add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader) and paste it between the Rock_proc_02 group node and the Material Output node. Connect the Shader output of the Snow_02 group node to the second Shader input socket of the Mix Shader node.
  3. Connect the Object output of the Texture Coordinate node to the Vector input socket of the Snow_02 group node as shown in the following screenshot:
    Mixing the material groups

    Starting to build the snowy rock mountain material

Creating the stencil shader

At this point, both the materials are assigned to the Mountain object, but if you render the preview now, they will appear on the whole mesh surface as a mixture of rock and snow. We must build a separator to establish where the surface will show only the rock and where it will show only the snow:

  1. Add a Geometry node (press Shift + A and navigate to Input | Geometry), two Mapping nodes (press Shift + A and navigate to Vector | Mapping), two Gradient Texture nodes (press Shift + A and navigate to Texture | Gradient Texture), and a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp).
  2. In the Properties panel of the Node Editor, label these four nodes as follows: Mapping01, Mapping02, Gradient Texture01, Gradient Texture02, and ColorRamp01. Connect the Normal output of the Geometry node to the Vector input socket of the Mapping01 node and the Position output to the Mapping02 node. Then connect the Mapping01 node to the Gradient Texture01 node and the Mapping02 node to the Gradient Texture02 node.
  3. Leave the Gradient Type of the Gradient Texture01 node as Linear and set the Gradient Type of the Gradient Texture02 to Quadratic. In the Mapping01 node, set the Location value of X as -0.210 and the Rotation value of Y as 90°. In the Mapping02 node, set only the Rotation value of Y as 90°.
  4. Add three MixRGB nodes (press Shift + A and navigate to Color | MixRGB). Set the Fac of the first one to 0.000 and label it as Add01. Then connect the Color outputs of both the Gradient Texture nodes to the Color1 and to the Color2 input sockets.
  5. Connect the output of the Add01 node to the Fac input socket of the ColorRamp01 node. Then set its Interpolation to B-Spline and move the black color stop to 0.600 position. Add a new color stop, set the color to pure black, and move it to the 0.700 position. Then move the position of the white color stop to 0.800.
  6. Label the other two MixRGB nodes as Burn01 and Burn02. Connect the Color output of the ColorRamp01 node to the Color1 input socket of the Burn01 node, and the Color output of this node to the Color1 input of the Burn02 node. Set the Blend Type for both the nodes to Burn.
  7. Add a Frame (press Shift + A and navigate to Layout | Frame) and parent all of these nodes to it. Label the frame as SLOPE as shown in the following screenshot:
    Creating the stencil shader

    The SLOPE frame

  8. Now press Shift + D to duplicate one of the Mapping nodes (press Alt + P to unparent it from the frame), and move it to under the SLOPE frame. Label it as Mapping03 and change the Location value of X to -0.600.
  9. Add a Noise Texture, a Voronoi Texture, and a Musgrave Texture node (press Shift + A and navigate to Texture | Noise Texture, repeat the same for all other nodes) and place them in a column next to the Mapping03 node. Set the Noise Texture node's Scale value to 4.600. Set the Voronoi Texture node's Coloring to Cell and the Scale to 28.700. Set the Musgrave Texture node's type to Ridged Multifractal, the Scale to 3.500, Detail to 16.000, Dimension to 0.900, Lacunarity to 0.600, Offset to 0.500, and Gain to 5.000.
  10. Connect the Vector output of the Mapping03 node to the Vector inputs of the three textures. Then add a MixRGB node (press Shift + A and navigate to Color | MixRGB), set the Blend Type to Burn, and label it as Burn03.
  11. Connect the Fac outputs of the Noise Texture and Voronoi Texture nodes to the Color1 and Color2 input sockets of the Burn03 node. Press Shift + D to duplicate the Burn03 node, label it as Burn04, and set its Fac value to 1.000. Connect the Color output of the Burn03 node to the Color1 input socket of the Burn04 node. Then connect the Fac output of the Musgrave Texture node to its Color2 input socket.
  12. Add a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp), label it as ColorRamp02, and paste it between the Burn03 and the Burn04 nodes. Set Interpolation to Ease and move the white color marker to the 0.487 position.
  13. Add a Frame (press Shift + A and navigate to Layout | Frame), select all of these nodes and then the frame, and press Ctrl + P to parent them. Label the frame as DENSITY as shown in the following screenshot:
    Creating the stencil shader

    The DENSITY frame

  14. Box-select the two frames (with all the nodes inside) and press Ctrl + G to create a group. Add a MixRGB node (press Shift + A and navigate to Color | MixRGB), set the Blend Type to Soft Light, and set the Fac value to 1.000. Connect the Color output of the Burn02 node inside the SLOPE frame to the Color1 input socket. Then connect the Color output of the last Burn04 node inside the DENSITY frame to the Color2 input socket.
  15. Drag the Color output of the Soft Light node into the empty socket of the Group Output node to create a new Color output on the interface. Then add a new ColorRamp (press Shift + A and navigate to Converter | ColorRamp), label it as ColorRamp04, and paste it between the Soft Light and the Group Output nodes. Set Interpolation to Ease, the black color stop to the 0.500 position, and the white color stop to the 0.600 position.
  16. Go to the SLOPE frame. Click and drag the Fac socket of the Add01 node to the empty socket of the Input Group node. Rename the new input as Snow_amount.
  17. Go to the DENSITY frame and attach the Vector input of the Mapping03 node to the empty socket of the Input Group node. Move it up by clicking on the little arrow icon in the Properties panel, and press Tab to close the group. Rename it as Separator as shown in the following screenshot:
    Creating the stencil shader

    The outputs of the SLOPE and DENSITY frames added inside the Separator node group

  18. Connect the Object output of the Texture Coordinate node to the Vector input socket of the Separator node group. For the rendering of the image at the beginning of this recipe, I've set the Snow_amount value to 0.724.
  19. Add one more MixRGB node (press Shift + A and navigate to Color | MixRGB), set the Blend Type to Add, and connect the Color output of the Separator group node to the Color1 input socket. Then connect the Color output of the Rock_proc_02 group node to the Color2 input socket. Set the Fac value to 1.000 and connect the Color output to the Fac input socket of the Mix Shader node.

Adding the atmospheric perspective

The final step we can do to improve our material is to append the Fog_underwater node group, from the 9931OS_05_underwater_final.blend file located in Nodetree. Rename this node Atmos_persp and paste it just before the Material Output node. Then press Tab to open the group by entering Edit Mode. Set the Multiply node value to 0.010 and the color values of the Emission shader for R to 0.078, G to 0.133, and B to 0.250 as shown in the following screenshot:

Adding the atmospheric perspective

The overall network and the atmospheric perspective node group added at the end of the shader. Note the Color output of the Rock material added to the output of the Separator to work as stencil or blending factor.

How it works...

Now let's see how this material actually works, by dividing the creation's process into three parts:

  • Firstly, we appended the Snow material and made a group, exposing the required properties and changing the way the bump works. In other words, we deleted the output to the Displacement input of the Material Output node and implemented a per shader bump.

    This doesn't really make a big difference in the final rendering. Just be aware that a bump piped in the Displacement socket can react to Ambient Occlusion (which we didn't use in the scene, by the way), but this is not true with the per shader bump.

  • Secondly, we appended the Rock_procedural material and made a group of it as well. Again, all the necessary values were exposed, and although we kept the material unaltered in this scene, the group could now be easily reused for different kinds of rock in other projects or on different objects.

    We added a Math node set to Multiply for every texture Scale value that needed to be driven by one single exposed input. The first Value of the Math node, set to the original scale value, gets multiplied by the driven second Value, thus increasing or decreasing (for values smaller than 1.000) the final scale value.

  • Thirdly, we built Separator, a node group outputting gray-scale values that are connected to the Fac input of the Mix Shader node, which works as a stencil map, separating the two different materials on the mesh surface accordingly to black and white values. The two gradient textures in the SLOPE frame, mapped on the position and the normals of the mesh and then blended together by the Burn nodes, make the snow material (the white color value of the stencil map) appear more on the mesh's faces that have more a horizontal trend than a vertical one. Thanks to the Add01 node, mixing the gradients driven by the exposed input Snow_amount and influencing the gradient of the ColorRamp01 node, it's also possible to set the quantity of snow (the white color in the stencil) on the whole object. The mixed textures in the DENSITY frame make the separation line between black and white more frayed and realistic, and so also the Color output of the Separator group that is added to a Color output of the Rock shader just before being connected to the Fac input of the Mix Shader. Have a look at the following screenshot:
    How it works...

    The only mask and the Rendered versions of three different values of the Snow_amount slider

In the preceding set of screenshots, you can see the different effects of the 0.000, 0.700, and 1.000 values of the Snow_amount slider. The black-and-white mask works as a separator between the rock and the snow materials.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.210