Blog

Creating Blend4Web Materials. Procedural Materials

2018-01-17

Today is the time to examine procedural materials. Our examples this time will be snow and tinfoil. If you’ve missed our previous articles, you can read them here.

Silk material from Blend4Web Material Library

There are certain types of materials that do include reflections, but produce most of their effects – even base colors – using pure mathematical calculations, without any kinds of textures. Silk, velvet, snow or tinfoil would be good examples of such materials.

The core of the silk material

If you take a close look at the core of the material, you’ll notice a single diffuse texture (1) that is used to produce the main effect. Highlights and lighting in general are made using several masks (3) that are generated procedurally and are based on normals (2) with camera position taken into account. The outcome looks very similar to the well-known Fresnel effect. Try to apply this material to a simple sphere, and you’ll see concentric rings that originate from the geometric center of the object. These rings are always set in the direction of the camera and do not depend on the environment or the positions of the light sources.

The video above shows the process of creating a mask with a Fresnel effect, complete with a normal map used for a backdrop. This, however, poses the question: why do all this when Blender features the Fresnel node that works perfectly fine?

This is because the built-in Fresnel node produces a highly lifelike effect, whith color gradient changing non-linearly from the center to the edges, as it does in real environment. This is perfect for creating reflection on a polished surface, but not very suitable for other tasks. So if your intent is to create an imitation effect, a custom node setup will be a better choice.

Node setup for creating Fresnel effect

The Fresnel effect is based on the Dot Product (1) node with the value of the vector being [0,0,1]. The image is then compressed a bit (2) using a dedicated SmoothStep node. After this, a color is applied to the image.

Snow material from Blend4Web Material Library

Now, let’s take a look on another interesting material that does not feature a diffuse component.

Node structure of the snow material

All the “magic” here happens inside of a dedicated node group (1). The shader basically combines the material with a baked Ambient Occlusion map and colors it with light shades. This way, SSS and light blue glow on the snow surface can be imitated.

Tinfoil material from Blend4Web Material Library

Now, it is time to get a glimpse of the inner structure of the tinfoil material.

It includes two textures. The first one is a normal map (1) used to add crease effect to the surface, while the second one is a Matcap (3) that handles the base matte background. The rest of the material is entirely procedural and uses masks (2) and Vector Math nodes.

Node structure of the tinfoil material

And this is all for today. In the next article we will talk about another type of complex materials such as water, ice and gemstones.

Comments
20 aug. 2024 15:18
I appreciate you supplying this very helpful knowledge. Since I work as a writer, I've noticed that pupils are quite interested in what they are required to learn. It is my recommendation that they seek assistance from professionals in assignment. Australian students can receive Nursing assignment writing help from a few websites. The top academic writer on the team plays an important role. An assignment writer is an expert who focusses on producing excellent, thoroughly researched academic papers on a range of subjects and topics.
Please register or log in to leave a reply.