Creating a simple ground material using procedural textures
In this recipe, we will create a basic, raw ground material as shown in this screenshot:
Start Blender and switch to Cycles Render. Then perform the following steps:
- Delete the default Cube and add a Plane. Go to Edit Mode and scale it 15 times bigger (30 units per side; press Tab, then press S, enter the digit 15, and press Enter). Go out of Edit Mode.
- Go to the Object modifiers window and assign a Subdivision Surface modifier to the Plane. Switch from Catmull-Clark to Simple, and set the levels of Subdivisions for both View and Render to
4
. Check the Optimal Display item. - Assign a second Subdivision Surface modifier. Again, switch to Simple, set the levels of Subdivisions for both View and Render to
4
, and check the Optimal Display item. - Assign a Displace modifier. Click on the Show texture in texture tab button to the side of the New button. In the Texture window, click on the New button, select Voronoi texture, and increase the Size value to
1.80
. Go back to the Object modifiers window and set the displacement Strength to 0.100
. - Assign a second Displace modifier and select the default Clouds texture. Set the Size value to
0.75
, the Depth value to 5
, and the displacement Strength value to 0.150
. - Assign a third Displace modifier. Again, select the default Clouds texture and increase the Size value to
4.00
(the slider arrives at a maximum of 2.00
, but you can click on the value and enter higher values) and the Depth value to 4
. Then switch Noise from Soft to Hard and click on the Basis button to change Noise Basis from Blender Original to Voronoi F4. Go to the Colors subpanel above the Clouds subpanel, and adjust the Brightness value to 0.900
and the Contrast value to 1.500
. Set the displacement strength to 0.500
. - In the Shading subpanel (which is accessible from the Transform menu), under the Tool Shelf tabs to the left of the 3D view, click on the Smooth button.
- Go to the World window and click on the Use Nodes button in the Surface subpanel under the Properties panel. Then click on the little square with a dot on the right side of the Color slot. From the menu, select Sky Texture. Set the Strength value to
1.400
. - Go to the Outliner and select the Lamp item. Go to the Object data window and click on Use Nodes. Then change Type of Lamp to Sun and set the Strength value to
1.400
. Change the light color values to 1.000
for R, 0.935
for G, and 0.810
for B. In the orthogonal top view (press the 7 and 5 keys in the numeric keypad), rotate the Sun Lamp by 90°
. - Place the Camera to have a nice angle on the Plane (you can also use the Lock Camera to View item in the (press N) Properties side panel), and switch from the 3D view to the Camera view (by pressing 0 from the numeric keypad).
- Split the 3D window into two horizontal rows. Change the upper row to a Node Editor window.
- Go to the Render window, and under the Sampling subpanel, set both the Clamp Direct and Clamp Indirect values to
1.000
. Go to the Light Path subpanel and set the Filter Glossy value to 1.000
. - Reselect the Plane and go to the Material window under the Properties panel. Disable the transformation widget by clicking on the icon in the 3D window toolbar or by pressing Ctrl and the spacebar, as shown in the following screenshot:
In the final scene, I added three UV Spheres with simple diffuse colors, just for lighting reference. Obviously, you can skip this step.
Let's now start with the ground material:
- Put the mouse cursor in the Camera view and press Shift + Z to switch the Viewport Shading mode to Rendered.
- Click on the New button in the Material window or in the Node Editor toolbar. Rename the material
Ground_01
. - In the Node Editor window, 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), and a Musgrave Texture node (press Shift + A and navigate to Texture | Musgrave Texture).
- Connect the Object output of the Texture Coordinate node to the Vector input of the Mapping node and the Vector output of this node to the Vector input of the Musgrave Texture node.
- Connect the Color output of the Musgrave Texture node to the Color input of the Diffuse BSDF shader. In the Properties panel, label the Diffuse BSDF shader as
Diffuse01
. Set the Scale value of the Musgrave Texture node to 0.500
. - Add a Wave Texture node (press Shift + A and navigate to Texture | Wave Texture) and a MixRGB node (press Shift + A and navigate to Color | MixRGB). Paste the MixRGB node between the Musgrave Texture node and the Diffuse01 shader node, and connect the Wave Texture node's color output to the Color2 input socket of the MixRGB node.
- Set the MixRGB node's Blend Type to Subtract and label it
Subtract01
. Connect the Mapping output to the Wave Texture node's Vector input. - Set the Wave Texture node's Scale value to
0.200
, Distortion to 20.000
, Detail to 16.000
, and Detail Scale to 5.000
. - Add a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp) and drag it onto the link connecting the Wave Texture node to the Subtract01 node to paste it between them. Label it
ColorRamp01
, change the Interpolation mode to B-Spline, and move the black stop to the 0.230
position (Pos:). - Add two Noise Texture nodes (press Shift + A, navigate to Texture | Noise Texture, and then press Shift + D to duplicate it) and name them
Noise Texture01
and Noise Texture02
. Connect the Mapping node to them. Select the Subtract01 node, press Shift + D to duplicate it twice, and change Blend Type to Divide and Dodge. Connect the Color output of the Subtract01 node to the Color1 input of the Divide node, and connect the Color output of the Noise Texture01 node to the Color2 input of the Divide node. - Then connect the Color output of the Divide node to the Color1 input of the Dodge node, and the Color output of the Noise Texture02 node to the Color2 input of the Dodge node.
- Label the Dodge node
Dodge01
and connect its output to the Color input of the Diffuse01 shader. Set the Noise Texture01 scale to 10.000
, Detail to 5.000
, and Distortion to 0.300
. For Noise Texture02, set Scale to 35.000
, Detail to 5.000
, and Distortion to 1.000
, as shown in the following screenshot: - Add two Voronoi Texture nodes (press Shift + A, navigate to Texture | Voronoi Texture, and rename the nodes
Voronoi Texture01
and Voronoi Texture02
) and a new MixRGB node (press Shift + A and navigate to Color | MixRGB). Set the Blend Type to Subtract and label it Subtract02
. Connect the color output of the Voronoi Texture01 node to the Color1 input socket, and the color output of the Voronoi Texture02 node to the Color2 input socket. - Set the Subtract02 node's Fac value to
1.000
, and then go to the Voronoi Texture01 node. Set Coloring to Cells and Scale to 18.100
. Go to the Voronoi Texture02 node, leave Coloring as Intensity, and set the Scale value to 18.000
. - Select the two Voronoi Texture nodes and the Subtract02 node, and press Shift + D to duplicate them. Label the texture nodes as
Voronoi Texture03
and Voronoi Texture04
, and the MixRGB node as Subtract03
. - Connect the Mapping node output to the Vector input sockets of the four Voronoi Texture nodes.
- Change the Coloring of the Voronoi Texture03 node back to Intensity, and set the Scale value to
18.500
. Set the Scale value of Voronoi Texture04 to 6.500
. - Add a new MixRGB node (press Shift + A and navigate to Color | MixRGB) and change the Blend Type to Dodge. Label it
Dodge02
and set the Fac value to 1.000
. Connect the output of the Subtract02 node to the Color1 input socket and the output of the Subtract03 node to the Color2 input socket. - Add a MixRGB node again (press Shift + A and navigate to Color | MixRGB). Change the Blend Type to Add and paste it between the Dodge01 node and the Diffuse01 shader node. Then connect the output of the Dodge02 node to the Color2 input socket.
- Disconnect the link between the Add output and the Color input socket of the Diffuse01 shader node, and add a Bump node (press Shift + A and navigate to Vector | Bump). Connect the output of the Add node to the Height input socket of the Bump node. Then connect the Normal output of the Bump node to the Normal input socket of the Diffuse01 shader. Set the Add node's Fac value to
0.280
and the Bump node's Strength value to 0.800
. - Add a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp) and label it
ColorRamp02
. Paste it between the Dodge02 and the Add nodes. Set Interpolation to B-Spline and move the black color slider and stop at position 0.330
. - Add a RGB to BW node (press Shift + A and navigate to Converter | RGB to BW) and paste it between the Add and the Bump nodes.
- Parent the nodes to a Frame (press Shift + A and navigate to Layout | Frame) and label it
BUMP
, as shown in the following screenshot: - Add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader) and a second Diffuse BSDF shader (press Shift + A and navigate to Shader | Diffuse BSDF). Name them
Mix Shader01
and Diffuse02
, respectively. Then paste the Mix Shader01 node between the Diffuse01 and the Material Output nodes, and connect the Diffuse02 node to the second Shader input socket of the Mix Shader01 node. - Once again, add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader) and a Diffuse BSDF shader (press Shift + A and navigate to Shader | Diffuse BSDF). Label them
Mix Shader02
and Diffuse03
. Then paste the Mix Shader02 node between the Mix Shader01 node and the Material Output node, and connect the Diffuse03 node to the second Shader input socket. - Connect the Bump node output to the Normal input of the Diffuse02 and Diffuse03 shader nodes.
- Change the Diffuse01 color values to
0.593
for R, 0.460
for G, and 0.198
for B; the Diffuse02 color values to 0.423
for R, 0.234
for G, and 0.092
for B; and the Diffuse03 color values to 0.700
for R, 0.620
for G, and 0.329
for B. - Once more, add a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader) and a Glossy BSDF shader (press Shift + A and navigate to Shader | Glossy BSDF). Label the first node
Mix Shader03
and paste it between the Mix Shader02 and the Material Output nodes. Connect the Glossy BSDF shader to the second Shader input socket of the Mix Shader03 node, and set its Roughness value to 0.300
and the color values to 0.593
for R, 0.460
for G, and 0.198
for B, just like the Diffuse01 color. - Connect the Bump node output to the Normal input socket of the Glossy BSDF node.
- Add a Layer Weight node (press Shift + A and navigate to Input | Layer Weight), connect the Fresnel output to the Fac input socket of the Mix Shader03 node, and set the Blend value to
0.300
. - Parent these recently added nodes to a new Frame and label it
COLOR
. - Add one more Noise Texture node (press Shift + A and navigate to Texture | Noise Texture) and a new ColorRamp node (press Shift + A and navigate to Converter | ColorRamp). Connect the Mapping node output to the Noise Texture node's Vector input (label it
Noise Texture03
) and the Fac output of Noise Texture to the Fac input of the ColorRamp node (label it ColorRamp03
). - For the last time, add a MixRGB node and set the Blend Type to Difference. Then connect the Color output of the ColorRamp03 node to the Color1 input socket of the Difference node, and the Color output of the Difference node to the Fac input socket of the Mix Shader01 node. Set the Fac value of the Difference node to
0.255
. - Set the Noise Texture03 node's scale to
1.000
and the Detail value to 5.000
. Switch the ColorRamp03 node's Interpolation to B-Spline, move the 0 value of color stop to position 0.285
, move the 1 color stop to position 0.740
, and click on the + icon to add a new color stop. Set its color to black and move it to position 0.320
. - Connect the output of the Dodge01 node inside the BUMP frame to the Color2 input socket of the Difference node. Connect the Color output of the ColorRamp02 node inside the BUMP frame to the Fac input socket of the Mix Shader02 node inside the COLOR frame.
And we're done! Here is a screenshot of what the Blender UI will now look like:
The way this material works is very similar to the sand material of the previous recipe, although a lot simpler:
- We mixed two slightly different colors using the values of a Noise Texture node as the stencil factor, then mixed a third, similar color on the ground of the bump output to obtain the whitish, pebble-like effect you see in the rendered image. We created the ground roughness using an ensemble of procedural textures mixed in several ways, whose total sum was then connected to the Normal input sockets of the three Diffuse BSDF nodes and of the Glossy BSDF shader, as shown in the following screenshot: