3D tutorials, tips and techniques, inspiration and community.

Sunday, October 30, 2011

Reusing Cycles Materials the Smart Way

Lately I've been working with Cycles quite a bit. I'm creating a new illustration for a book cover, and I decided I would do the render in Cycles. Tweaking the lights and the materials in Cycles is really fun, because you can see the results in pretty much real time, which takes away much of the guesswork associated with materials and final appearance.

One of the objects I'm modeling is supposed to be made of red plastic. Cycles comes with a quick and dirty, default “shiny plastic” shader—it's called Glossy. However, I feel that the Glossy material does not yield a very convincing plastic. I decided to try something niftier. I'm talking about a Mix Shader. A Mix Shader is a material that is the result of mixing the properties of two other materials.

In a Mix shader. you can specify which areas receive material A, and which areas receive material B through a grayscale image input, which you can customize on the Fac input in the material panel. Among other fun facts, Fac can be controlled by what's called a Fresnel. In 3D applications, fresnel defines the transparent versus reflective mix in a material. You notice the effect when looking at a small body of water from a shallow angle and the water becomes reflective instead of transparent. In Cycles, using the Fresnel to control the mix of two materials, where one of them is shiny, can produce, in my opinion, a very convincing plastic material.

The interesting bit of this is that you can create a material, itself a Mix Shader material, and plug it into slot A or B of another Mix Shader material. To do this, you need to go to the Node editor, group the nodes that make up that material, and group them. Cycles will save that group as another material option in the pull down menu that show up when creating new materials. Basically, you can save very complex material setups and reuse them by just selecting them from a menu! Sweet stuff! Here is an overview of this workflow.


First, we create a red plastic material. This is the setup used for the Red Plastic material, shown here both in the Material panel and in the Node editor. Every option in the Material panel gets reflected in the Node editor.
Note: at this time, some nodes (or options) can only be accessed from the Node editor at the moment.

Next, we create a node group, which we'll use later as part of another Mix shader.



Very quick render showing the red plastic material so far.
The next step would be to create a new Mix Shader material.
Then, we'd choose the Red Plastic node group we just created on the shader slot A.


Here's the rest of the setup. We use a simple, plain white Diffuse
shader on slot B. For the control texture, I'm going to use a striped
texture. I'll choose Generated for the mapping of this texture, and we're done!



Final render, at 100 samples. Red plastic stripes with white diffuse material.



1 comment:

  1. Great object design, though I'd probably suggest a better texture. Good job overall though.

    ReplyDelete