For the layman – How 3D Rendering Works. Part 2: Materials & Shaders

[ about a 15 min. read ]
Part 1: 3D models

So you have your 3D model. It is either a polygon model or a CAD NURBS model (as stated in the previous article). So we import it in our 3D rendering software, but it still doesn’t really look like much. Most likely it just looks dull and grayish. But assigning the right materials to all the parts of the model, and tweaking the properties of the materials to your liking, will greatly change this (along with adding texture, but we’ll cover that in the next article).

So let’s talk about materials. Specifically what are they in a 3D software kind of sense and how do we make them look the way we want them to.

1. What is a Material and a Shader?

To understand how changing the look of a 3D object works, you actually need to consider the following diagram:

You have a 3D model. You have it in a 3D rendering software, and this software provides you so called Materials and Shaders to assign to the model to change the look of the model. So you assign a Material to it. Attached to the material is a Shader and possibly some Textures. So what exactly are all these three items:

Material – Now the material is basically a container for the shader and textures. It is the primary interface towards the user. It contains the overview of all the properties and definitions you have to be able to tweak the look of the material. This can be things like the color, transparency, reflectivity and many more depending on the type of material.

For example, in a software package it may look like the example below. Where you have a color swatch that you can change to the color you want. And a slider to adjust the reflection roughness value:

Shader – Now the shader determines which options you have available in your material. It basically hangs behind the scenes of the material and does all the heavy lifting. It contains all the algorithms and mathematical programming on how each property is influence by the light input from your 3D scene. So this specifically determines how light in your scene is translated to the look that the material gives you in your final 3D render.

Textures – We will touch upon these more in the next part of this blog series, but for now, textures are flat images that are assigned to the properties of a material to further tweak how the material will look in the end. The shader uses the texture image input to further determine how light from your 3d scene needs to be translated to the final image.

2. Material properties examples

I can imagine that this all sounds a bit vague and complex. But what it comes down to is that the combination of material, shader and textures determine how a material looks and behaves based on the light input from your 3D scene. For example, for a Plastic Material you can change its color attribute from red to for example blue:

But you can also change its reflectivity attribute (or roughness) to make the material look more matt or more reflective:

These are properties provided by the Shader to the Material, that we can then change. Now if we have a Metal Material for example, you still have the same properties to change (e.g. color and reflectivity). But because there is a different shader attached to a metal material, the look and behavior of the material is different. Changing for example the color property of a metal from its standard gray value to a red value results in the following look:

And changing the reflectivity property from shiny to a matt metal results in the following:

And for a more direct comparison we can look at the red plastic side by side with the red metal. It makes it quite obvious what the influence of the shader is. They both have the exact same color and reflectivity values, but they just have different shaders, and therefore react differently to the light in your 3D scene.

3. Material examples

So you have different types of materials for different types of applications. Like in the featured image at the beginning of this post. Which showed 5 different types of materials (and thus 5 different shaders). From top to bottom and left to right. You can see a translucent soft brown plastic, a toon outline material, a red shiny hard plastic, a solid glass and a stainless steel material.

So knowing all of this we can start to assign the right types of material to our 3D model, and tweak the material properties to make the materials look the way we want them to. So we go from a standard starting gray material to a fully materialized model.

For the binoculars example this means applying a matt black plastic and shiny black plastic to parts of the body. A glass lens material to the lenses. Some rubber material to the eye ports. A white matt plastics to the lettering on the top. And a metal material for the screws. Of course for each material you tweak its individual properties to your liking (e.g. color, roughness, reflectivity). And where required you will add textures to further enrich the materials (we will cover that in the next article). In the end, you will end up with this:

Note!: There is one last side note I want to make. I have talked about different materials having different shaders. But in a lot of 3D rendering software you have general shaders with so many properties, that with the single shader you can replicate almost all materials. From plastics and metals, to glasses and complex semi-translucent materials. But that is of course way outside of the scope for this article. But just so you know, such shaders exist and are quite common for use in the mayor 3D rendering software’s out there. It requires a lot of knowledge, skill and experience on actual material properties to properly use those shaders.

I hope you have enjoyed this post and have learned something new. Let me know if you have any questions or comments below.

Leave a Reply

Your email address will not be published.