Book Image

Blender Cycles: Materials and Textures Cookbook, Third Edition

By : Enrico Valenza
Book Image

Blender Cycles: Materials and Textures Cookbook, Third Edition

By: Enrico Valenza

Overview of this book

Table of Contents (17 chapters)
Blender Cycles: Materials and Textures Cookbook Third Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Using displacement


The last input socket of the Material Output node is Displacement. Sadly, it seems that at the moment, its use is limited.

Getting ready

By enabling Experimental in the Feature Set option under the Render tab in the Render window, it's possible to have access to an incomplete displacement feature:

  1. Open the start_03.blend file, select the Spheroid, and delete its material.

  2. Go to the Render window under the Properties panel. In the Render tab, click on the Feature Set button, labeled with Supported by default, and select Experimental.

  3. Go to the Object data window to find a new tab named Displacement, where we can choose between three options: Bump, True, and Both (the Use Subdivision and Dicing Rate buttons don't seem to work yet).

    Note

    Bump will give us the average bump effect, which is the same as connecting the texture output in the Displacement input of the Material Output node (this is a different way to have an overall bump effect, and it works without the need to set the Feature Set option to Experimental).

    By setting the method to True, we can have a displacement effect that is not different from the Displace Modifier output, and the mesh must be subdivided.

    Both will use the texture gray-scale values' information for a displacement and the bump effect together.

  4. Select True.

How to do it...

  1. Go to the Material window under the Properties panel and click on the New button. In the Displacement tab, click on the Default button, and in the pop-up menu, select the Image Texture node.

  2. Click on the Open button, browse to the textures folder, and load the quads.png image.

  3. Split the bottom 3D window to open a UV/Image Editor window.

  4. Press Tab to go to Edit Mode. Then press U with the mouse pointer in the 3D window. In the UV Mapping menu, select Smart UV Project, then load the quads.png image in the UV/Image Editor, and press Tab again to go out of Edit Mode. Note that this is the quicker way to unwrap the Spheroid, which is still a Cube at its lower level of subdivision. If you want, you can do a better unwrapping by placing seams to unfold it and by selecting a normal Unwrap option from the pop-up menu.

  5. Go to the Object modifiers window and raise the Subdivisions levels for both View and Render to 6.

  6. Add a Math node (press Shift + A and navigate to Converter | Math) and paste it between the Image Texture node and the Material Output. Set Operation to Multiply, and the second option, Value, to 2.000 (if you don't see any modification in the rendered preview, it's an update issue, which can be solved by pressing Tab twice to go in and out of Edit Mode).

  7. Add a Glossy node (press Shift + A and navigate to Shader | Glossy BSDF) and a Mix Shader node (press Shift + A and navigate to Shader | Mix Shader), and connect them to build the average basic material we already know.

  8. Add two MixRGB nodes (press Shift + A and navigate to Color | MixRGB) and connect them to the color input sockets of the Diffuse and the Glossy nodes.

  9. Finally, connect the color output of the Image Texture node to the Color1 input sockets of the MixRGB nodes, and set colors for the Color2 sockets. Here is a screenshot of a checker image texture used as displacement for your reference:

    A checker image texture used as a color and output for the Rendered displacement of the Spheroid

    Instead of the Smart UV Project option to unwrap the Spheroid, try the default 1:1 UV Mapping (the Reset item in the menu, which gives the whole image mapped on each face). The following screenshot shows the checker image texture used with the different unwrap:

    The checker image texture used as a color and output for the rendered displacement of a Spheroid with a different unwrap

  10. Save the file as 9931OS_01_displacement.blend.

In any case, this is just for a temporary demonstration; the feature is still incomplete. At the moment, it seems to work quite well only if the texture is mapped with UV coordinates. This is definitely going to change in the future.

How it works...

Simply put, the gray-scale values of the texture are multiplied by the value we put in the second slider of the Math node. For example, if we set a value of 0.500, the intensity of the effect will be the half of the default value (1.000 x 0.500 = 0.500). With a value of 3.000, the effect would be three times the default value, and so on. Similar to Blender Internal, the value can also be set as negative, thereby inverting the direction of the displacement.