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 volume materials


Very briefly (because there are dedicated recipes in the last chapter of this Cookbook), let's take a look at how volumetric materials work in Cycles.

Volumetric materials are exactly what they sound like. Instead of the surface of an object, Cycles renders the inner volume of that object, and this gives space to a lot of interesting possibilities—not only can elusive materials such as smoke, fire, clouds, or light transmission effects through the medium be realized, but peculiar shapes can also be obtained from the volume itself by Boolean operations made through material nodes.

The drawback is that volume materials are slow—a lot slower compared to the surface materials, but hopefully, this is an issue that will be fixed in some way in the future (be aware that from Version 2.72, volume materials are available on GPUs too).

Getting ready

Let's start with our usual Spheroid blend file:

  1. Open the start_02.blend file and delete the material assigned to the Spheroid.

  2. Put the mouse cursor in the 3D view and press Shift + Z to navigate to the Rendered view.

  3. Click on the New button to add a new material, and then switch the Diffuse node link from the Surface input socket to the Volume input socket of the Material Output node.

How to do it...

Now let's go to the volume section of the Material window with the following steps:

  1. Go to the Material window under the Properties panel, and click on the Diffuse BSDF labeled button to the side of the Volume item. In the pop-up menu, select the Volume Scatter node as shown in this screenshot:

    The Rendered preview of a Volume Scatter node assigned to the Spheroid

  2. Change the Density value of the Volume Scatter node from 1.000 to 50.000. The Spheroid looks a lot more solid now, as shown in the following screenshot:

    The effect of the Volume Scatter node with increased density

  3. Add a Voronoi Texture node (Press Shift + A and navigate to Texture | Voronoi Texture). Connect the Fac output to the Density input socket of the Volume Scatter node. Set the Voronoi scale to 3.800.

  4. Add a Math node (Press Shift + A and navigate to Converter | Math) and paste it in the link between the Voronoi Texture and the Volume Scatter nodes. Set Operation to Less Than and second Value to 0.100.

  5. Add a second Math node and paste it right after the first node. Set the Operation to Multiply and second Value to 50.000. Here is a screenshot of the output of a Voronoi Texture node for your reference:

    The output of a Voronoi Texture node used as Factor for the density of the Volume Scatter node

  6. Click on the Color button of the Volume Scatter node. Set the RGB values to 0.800, 0.214, and 0.043, respectively.

    The scattered light is obviously of a hue complementary to the color assigned to the volume

  7. Save the file as 01_volumetric.blend.

How it works...

We have seen that when we increase the Density value of the Volume Scatter node, the Spheroid starts to look more and more solid. So, we used the output of a Voronoi Texture node and clamped it with a Less Than node to show only the values that are not beyond the 0.100 limit. Then we multiplied the value by 50.000, thus increasing the density of the Voronoi spheres and making them appear as solid objects inside the Spheroid volume.

Remember that in this case, we rendered only the inside of the object and not the surface. Anyway, a combination of Surface and Volume is possible and can give interesting results, as shown in the following screenshot:

Combining a Glass shader for the surface with a Volume Scatter node for the inside of the mesh

There's more...

Volumes also work in the World. In fact, the World Output node now has a Volume input socket. By connecting a Volume Scatter or Volume Absorption node to the World Output node, it is possible to obtain several special effects, for example, fog, mist, atmospheric perspective, atmospheric scattering effects, and a body of water for an underwater scene. Clearly, it's also possible to fill this environment volume with textures.

In any case, you won't usually fill the entire World with a volumetric material because the World in Blender is considered as going to an infinite distance, and this would make the volume calculation too heavy. It's better to use a scaled Cube, properly placed and filled with the volume material.

To know more about volume materials, go to the last chapter of this Cookbook or to the documentation on the wiki at http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Materials/Volume.