Don't get too cosy, there's nothing interesting here

Shaders, Materials and Textures in Blender

01 January 2015

Introduction

We're in the middle of tutorial and by now you should be able to build your own furniture models with proper UV mapping. In this part I'll try explaining how to make your work even more alive by creating realistic looking shaders. Of course I won't be able to cover every aspect of this wide topic but I'll try explaining some of the cool tricks and techniques I use personally in everyday work.

First of all, let's make a short clarification about the words we'll be using. What I understand as "material" is an existing, specific kind of surface that can be distinguished by it's color or reflectivity. This refers to real life objects and properties in general. "Shader" is CG version of real life material. It can have similar properties and can be freely adjusted by user. "Texture" or "texture map" is a bitmap file that we'll be using for creating our shader color, adjusting its reflectivity or bumping its surface.

I'll try showing you how to re-create most common material types such as glossy surfaces, glass or common metals. What I also find necessary is explaining the philosophy of shader building process in Cycles since It's a bit different than in other rendering engines on the market. With this knowledge I really hope you'd be able to do your own experiments and create realistic looking shaders.

Basic material principles

When looking at any surface, your brain automatically interpreters it and correlates to what you already know and have experienced in life. For instance, you can spontaneously assign temperatures to different colors where red would represent something hot and blue being cold. You'd also think of concrete surface being rather matte while metal being shiny. It's helpful in everyday life as our brain doesn't have to analyze everything it sees, however it makes it more difficult to understand what you actually see when looking on a certain material. What's the actual color of chromed surface? What's the reflectivity difference comparing it to other metals? What's causing the surface imperfections - tiny bumps or material being more matte here and there? These are the questions you'd have to ask and know the answers when re-creating real life materials in any CG software.

Diffuse Factor

In CG world "diffuse" or "color" is a term for what we usually understand as a real "color" of the material or particular surface. It is also strongly correlated with mate, non reflective objects as they seem to look neutral no matter of the surrounding environment. We can easily distinguish the color of orange fruit, having more problems describing shiny metal. However, keep in mind that in real life, all surfaces are reflective and purely "diffuse" materials don't exist.

Diffuse color can be also defined by using image textures for more complex surfaces like wood, marble, fabric etc.

Reflection Factor

I think reflectivity is the most important factor if you wan your shaders and models look nice and realistic. As mentioned earlier, in real life each material is reflecting the environment in more or less noticeable way. Different materials vary according to their "diffuse" color or texture and they can also have different reflectivity. In CG world this attribute is controlled in various ways and I'll explain it more closely in practical examples later on.

100% diffuse setup visible on the left

30% diffuse / 70% reflection setup visible in the middle

100% reflection setup visible on the right

As you can see above, creating a basic, reflective shader comes just from mixing two different material properties in the desired proportions. However, materials like this don't exist in real life as the reflectivity always differs depending on the viewing angle. This is the most important factor very often omitted by inexperienced 3D artists.

Depending on the software, there are different ways of controlling reflectivity angle effect but let's first try to fully understand what is it all about. Make your own observations in real life - try grabbing some objects around and look at them from different angles. You should notice how the reflections change when looking at the surface directly straight and then going closer and closer to zero degree.

Low angle reflection setup visible on the left

Medium angle reflection reflection setup visible in the middle

High angle reflection reflection setup visible on the right

In the example above, reflections are dependent to the surface curvature. Building your shaders this way gives much more convincing and realistic results. What you can also observe is not only the reflectivity change depending on the surface / viewing angle (best visible on the left and middle models). It is also the general reflectivity of the shader being changed. Still there are more reflections visible on the edges, however on the right example the center part of geometry gets more reflective as well.

It is also worth mentioning that reflections can have different colors. For most non metallic surfaces the color will always vary from white to dark grey. Metals such as gold or brass will have tinted reflections in the middle section, becoming purely white on the edges and low angles. In the examples below, shader is 100% reflective even if the color tint makes it look a bit like diffuse + reflectivity mix.

White reflection color setup visible on the left

Grey reflection color setup visible in the middle

Red reflection color setup visible on the right

Roughness Factor

Shading roughness (also called glossiness or hardness) can refer both to the diffuse, reflection or transparency properties. By changing this attribute we can make our reflections more blurry, glass shaders more "foggy" and diffuse surfaces more light absorbing. Same as with reflections, glossiness also changes depending on the viewing angle, however not for purely diffuse or glass shaders.

No reflection roughness setup visible on the left

Medium reflection roughness setup visible in the middle

High reflection roughness setup visible on the right

The above example shows shader with the same reflectivity value (more reflections on the edges but same amount in the middle) with three, different roughness settings. At this stage reflections are blurred evenly no matter on the viewing angle. Please note that right example looks definitely matte but is something totally different than clean, diffuse shader we've discussed earlier.

The example with blending reflection roughness can be treated as a "base" shader for all non-transparent and non-metalic materials you'd like to re-create in CG world. Unfortunately there aren't any universal settings that would look good in every environment, but the shader presented above can be easily adjusted and adapted to many situations, always giving nice looking results. Viewing angle roughness change may be considered as a very subtle effect, but it will add great amount of realism to your scenes and 3D models.

Roughness / glossiness does not always referrer to reflections only. You can use this parameter to re-create blurry or "foggy" glass materials as you see in the picture above. For diffuse shaders, roughness allows you to increase the amount of light being absorbed by the surface.

Glass setup with no roughness visible on the left

Glass setup with little roughness visible in the middle

Glass setup with high roughness visible on the right

Bump and Displacement Factor

Bump and Displacement factors are used for adding physical imperfections to your shaders like cracks, scratches, tile fugues, joints. Sometimes it is necessary and easier to add details like this by simply modeling them or sculpting onto the surface. However, properly created displacement textures can also make miracles.

Bent, plane surface with displacement texture applied.

For creating bump effect you always need either image based texture or procedural one like noise for instance. A common mistake with using bump is setting its value too high and mixing it up with the reflection roughness as this can be also simulated using image texture. What I do personally is setting my shader's reflectivity first and then adding surface bumps. They should simulate only minor physical imperfections like scratches or small cracks. For "deeper" and more distinct surface details I suggest using displacement textures.

Please notice reflection imperfections visible in the middle rendering. The effect was achieved by using texture map for fine tuning reflectivity roughness which is often mistaken and created by bump map. The way of achieving best looking results is applying surface bump effect after defining shader's diffuse and reflections.

Besides bump and displacement, we can also use "normal maps" however I'm not a big fan of these for several reasons. First of all, the final effect is only slightly better to regular bump and still very far from using displacement. Second, to create normal maps we either need to generate them in external software or use some additional plugins which takes time (and I'm quite a lazy person). Third, normal maps look totally different to reflection, roughness or bump textures which you'll be using regularly for building your shaders. All of these use only black and white values which can be mixed together for achieving different results - normal map uses colors which eliminates it from any other use than generating surface bump. Last but not least - normal maps aren't so easily adaptable to different rendering engines, giving different results depending on used gamma settings for example. This makes work even more troublesome if you'd like to quickly adapt and test your 3D models or scenes in other applications. However, if you're looking forward to creating detailed real-time animations or game engine models, you'll have to know how to properly handle normal maps.

Please Note

When writing this article, displacement effect wasn't still fully implemented within Cycles shading / material system and the only officially supported way of achieving it was using the Displacement Modifier. This topic will be covered more deeply in next tutorial part about creating the environment and adding more details to your scenes.