In this recipe, we will create a realistic rock material that looks like the samples shown in the following screenshot, using an image map. We'll see a material made with procedurals in the this recipe.
The image-based rock material as it appears in the final rendering
Image maps are particularly useful for several reasons: they already have the necessary color information of a natural surface ready to be used; they can be easily edited in any image editor to obtain different kinds of information, for example, high levels for the bump maps; and they are processed faster than procedurals by the software (procedural textures must be calculated every time). Moreover, they can nowadays be found easily on the Web for free, in several sizes and resolutions.
For our recipe, we'll use the rockcolor_tileable_low.png
image map, which you can find in the textures
folder provided with this cookbook. This is just a low-resolution texture image provided for the sake of this exercise. Obviously, you can use any other different image with a bigger resolution. Here is a screenshot of the tileable rock image texture for your reference:
The tileable rock image texture provided with this cookbook
In any case, for any image you are going to use, just remember to make it tileable in your preferred image editor. In GIMP, this task can be automatically done by a plugin that can be found by navigating to Filter | Map | Make Tileable.
Start Blender and load the 9931OS_02_interface.blend
file, which saw in the previous chapter. Remember that all the blend files and the textures needed for the exercises of this module can be downloaded from the support page on the Packt Publishing website.
Now, we'll create a new file named 9931OS_start.blend
, and we'll be using it as the starting point for the most of our recipes. To do so, perform the following steps:
2.000
and the color values to 1.000
for R, 0.872
for G, and 0.737
for B.9931OS_start.blend
.Now carry out the following steps to create the rock material:
Material.001
as Rock_01
(the numbering is because I assume that you are going to experiment with several values, especially colors, producing more and different kind of rock materials) and save the file as 9931OS_03_Rock_imagemap.blend
.The overall view of Blender's customized Default screen with the rendered preview of the pink Cube
textures
folder, and select the rockcolor_tileable_low.png
image.The rock image texture loaded in the Image Texture node
4
both for View and Render. Then check the Optimal Display item.0.250
.0.200
to soften the seams (this factor is used to blend the edges of the faces of the Cube that, remember, is still a six-faced solid at its lower level, though looks like a Spheroid as of now). The output of blurring effect of the Blend factor is shown in the following screenshot:The edges seams visible on the surface of the subdivided Cube, and the blurring effect of the Blend factor
0.495
and the white marker to position 0.235
, as shown in this screenshot:The ColorRamp node pasted between the Image Texture and the Diffuse BSDF nodes
1.000
, as shown in the following screenshot:The Bump node pasted between the ColorRamp and Diffuse BSDF nodes
0.150
and the Mix Shader node's Fac value to 0.300
. Connect the Normal output of the Bump node to the Normal input socket of the Glossy BSDF shader, as shown in this screenshot:Adding the Mix Shader and the Glossy BSDF nodes
0.800
. Click on the color slider of the RGB node and set the values to 0.407
for R, 0.323
for G, and 0.293
for B, as shown in the following screenshot:Setting the color for the material
1.000
.Adding more variations to the rock color
Rock_01
material as shown in the following screenshot:We mapped a colored image of a rock with the Box option available in the Image Texture node (developed by the Project Mango team for open movie production of Tears of Steel to quickly map objects without the need to unwrap them), and set the Blend factor to 0.200
to have smooth transitions at the corners. Although we had a tileable image texture, this has been necessary because we set the Scale values for the three axes in the Mapping node to 0.250
.
First, by connecting the MixRGB node's Color output directly to the Color input of the Diffuse BSDF shader node, we had a quick visual feedback of the image mapping, and thanks to the ColorRamp node, we achieved the following goals:
This contrasted result has been applied as a bump map to both the Diffuse BSDF and Glossy BSDF shaders.
Then we mixed a brownish color (the RGB node) with the Color output of the image of the rock, and the result was added to the Image Texture node's output.
We can improve the rocky effect by adding displacement to the geometry. Unlike bump or normal effects on the mesh surface, which are just optical illusions giving an impression of perturbing the mesh surface, displacement is an actual deformation of the mesh based on the gray-scale values of a texture.
At least in this case, there is no need for precise correspondence between the already textured surface and the displacement because it would be barely noticeable. Therefore, we can use object modifiers to obtain a fast but effective result, by performing the following steps:
Rock_imagemap.blend
file we just created, select the Cube and go to the Object modifiers window under the Properties panel. In the Subdivision Surface modifier already assigned, lower the Subdivisions levels for both View and Render to 3
.4
.2.00
and leave the rest of the values unchanged. Go back to the Object modifiers window and set the modifier's Strength value to 0.800
.1.20
. Back in the modifier, set the Strength value to 0.300
.0.150
, as shown in this screenshot:A different rock model, thanks to displacement
Of course, these are just basic values. You can change them and also play with different kinds of procedural textures to obtain several rock shapes.