The Facebook “Blender Procedural Textures” page runs a weekly contest to use procedural textures to match a specific texture, usually from a photograph. This image is similar to my entry for one of the contests. Most of the texture will be familiar to you if you create your own bump pattern and cracks, that are made with common techniques for doing so. The method for creating the layers may not be: it is not the typical approach.
This is a step by step explanation of the approach taken. If you understand what each of the individual nodes do, you will have no trouble following it. The examples were created using Blender 2.79b. Most of the approach should apply to any release with cycles. The displacement will not, but a bump map may be substituted.
Analyzing the texture
This texture can be described as having these parts
- The displacement of the underlying wall
- Obviously, the paint layers
- soft wear, in the forms of speckles and dots
Normally this could be accomplished using the techniques described in BlenderInsight, Joakim Tornhill’s excellent manual Procedural Wear from A to Z in Blender. The manual can be found in the files section of the Facebook procedural textures page.
A close inspection of the original photograph, (which I do not have permission to post) shows that there is different kinds of wear in each of the segments, possibly because a different pigment was used for each and wore differently.
How to create regions and use them to select between textures
The simplest approach is to create a color ramp and use it to select the colors. Use a gradient texture for the color ramp fac and get something like
There are two obvious problems: the bands are vertical instead of horizontal, and they blend. The first is easy to solve: rotate the plane. The second is also easy: switch the color ramp from linear to constant
Rotating the plane is left as an exercise for the reader. The edges are too straight, so add some noise.
Use the multiply to control the strength of the noise texture. Use the color ramp to set the color, number, order and width of bands. This will do for most purposes, but it is very difficult to use it to put a different texture in the blue region than in the green. Is there another way?
Yes. One way is with math. It’s easy math, so take a calming breath and follow along. Start by thinking about how to mix two colors, so that one or the other is chosen, but not both. We can do this simply using a greater than node. We can easily split the plane in half this way
This image is produced by this simple node group.
The gradient texture produces a number between 0 and 1. Greater than compares that value to its other value, in this case .5. If the upper value, from the gradient, is greater than the lower value, greater than returns 1, otherwise 0. When the mix input factor is 0, only the top color is used, otherwise the bottom color. You change the width of the region by changing the value being compared to.
Add another region by adding another greater than and mix.
This image is produced by this node group
We can continue to add as many bands as we want.
There is one more feature of the banding to model: the bands slope downward from left to right. One way to do this is through the use of texture coordinates. Replace the gradient texture with a texture coordinates node’s generated coordinates and get
This is not precisely what we want.
This node group will give us exactly the same results as the gradient texture, but for a different reason. Any point on the plane can be described by two numbers, the distance along the bottom, X and the distance along the side, Y. X varies from 0, on the left, to 1, on the right. Y from 0 on the bottom to 1 on the top.
Add the slant by combining X and Y. We could simply add them, but we only want X to have a small effect, so multiply it by a small number.
This looks good, three bands, slanted in the right direction. Add a little noise and you have what you want. (Notice that I also rotated the bands).
The texture coordinate provides the position of a point. The y value is used to select the band edges. As x gets larger going from left to right, it is added to y, giving the slant.
Let’s add a texture that applies only to the blue band, just a simple Voronoi to demonstrate.
This is straightforward. Replace the color in the color mix with the mixed texture. Now let’s add a texture that crosses all the bands. This is ugly, but it shows the effect.
Add the noise on the borders back in and the result looks like this
and is produced by this
The overlay texture is mixed with the output of the band mixture and provides the color to the diffuse node.