A procedural layered wall in Blender Cycles – Part 1: creating the layers


A section of a wall

This texture was a contest entry in the Facebook page “Blender Procedural Textures”

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

  1. The displacement of the underlying wall
  2. Obviously, the paint layers
  3. soft wear, in the forms of speckles and dots
  4. scratches

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

Gradient bands with linear color ramp

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.

The evolution of a character model

As I follow the steps in Blender Production, (see this blog entry for details), one of the things I’ve discovered that the author didn’t discuss is how evolving skills with blender impact the animation work flow. The character I’m developing for my little animation has evolved from a simple stick man to a full human model with a complete rigging, but it has been a several week diversion and required redoing my master reel.

My first idea was to animate a literal stick man.  It would have a body, arms, and legs that were simple cylinders. There would be no arms or feet. The head would be a featureless sphere.  Easy to model, trivial to animate.  I soon realized that I wanted arms and feet, and that the body should have a different cross section than the limbs.  I came up with a design that was still trivial to model.

Rough stick man figure

My first attempt at modeling a character. The idea was to have a very abstract character in a very realistic environment

The awful colors were not meant to be used in the final animation. They were simply to make it easy to distinguish the bits. It took a whole ten minutes to model.  Most of the time was spent getting the proportions I wanted.  It worked fine for the story reel, but there was no way it would work in the finished animation.  I thought I could get away with simply modifying it a bit to fix the proportions.  This result was also disappointing.

Stick man evolves

Some size and shape tweeking and horrible cone feet and hands are not enough.

The tweeked version looked good enough to use for rough animation.  I redid the storyboards and story reel using it. I realized I had no idea how to build the rig of controls that would allow me to animate it.  This led to my first diversion, Blender’s Armatures: A Crash Course, which is a brief but dense introduction to blender’s armature, the main tool for controlling characters in animation.

Having completed the tutorial, and armed with a little knowledge, I made a simple rig of 14 bones. This took me nearly two days, as I learned by doing the things I hadn’t really understood from the tutorial. In the end I had a simple, difficult to use rig for my character. I spent a couple of weeks using it to make a master reel, with the character posed for each of the key frames.

While I was doing all of this, I was also trying to learn character animation from tradigital Blender. I got as far as the example of creating a walk and was overwhelmed by the amount of control a believable character would need. It became clear that my simple rig would not serve.  I found another excellent tutorial, DVD training 8: Humane Rigging. Unlike previous tutorials, it consists of more than one video.  There are, in fact, 35 videos, a DVD’s worth, which explains the “DVD training” in the title.

If you want to learn how to rig characters in blender, I highly recommend this tutorial.  It goes through five different characters and rigs them. Each character is briefly introduced and its animation requirements are discussed. A series of videos introduce a particular rig designed to solve a specific problem. The problem is described, alternatives are presented and discussed, and the rig is put together step by step to show how it is done. One or more videos are then spent on putting the  various rigs together into a single rig.

I learned a great deal from the video and feel it was time well spent. The downside was that I spent two weeks watching the tutorials and playing along at home, building each rig in Blender.

Between reading tradigital Blender, watching the two tutorials, and setting up the first attempt at a master reel, it became clear that rigging was going to be difficult and time consuming and that I needed a more realistic character. An abstract character simply wasn’t going to work. I started another digression, starting to follow a tutorial on how to model characters for animation.

Then I was reminded of makehuman, an open source tool designed to, well, make humans.  With makehuman, you can create a usable human mesh in very little time. Makehuman has a very shallow learning curve, at least to reach the point where you can export a usable character for blender to import.  I also encountered rigify, a blender add on that makes character rigging easy. I spent an hour stumbling around with makehuman and blender, finally reaching my current character. It was generated in makehuman and imported into blender.  The import allows selecting between the rigging that makehuman generated, or a rigify rig. I don’t see anything wrong with the makehuman rig, but am trying the rigify rig to see how well it will work.

Current stick man figure

A makehuman character, slightly tweeked from the default, with “clothing” being nothing more than colors

It took another hour of fumbling around to replace my abomination with this character and generate a new master template file. In the new master file, the character is posed in each of the keyframe positions, but the poses are not very good.  But it’s good enough to use as a starting point.

In total, I was diverted from my animation project for six weeks.  I will need some of the things I learned, so it wasn’t time wasted. I may never rig anything from scratch, but the tutorial taught me a good deal I didn’t know about how the controls of a good rig are implemented and how they work.  That will help a lot when I use rigify to animate the makehuman character.

Had I remembered makehuman, even without being aware of rigify, I could have generated a usable humanoid character, even with fumbling around learning how to export an import, in less than an hour. This would have saved me significant time, but I wouldn’t understand rigging as well as I do now.  I consider the knowledge a fair trade for the time.

Making an animation – part 1: preproduction


I’m making a movie.  Do I get to say ‘movie’ in the 21st century?  I guess I’ll call it an animation.  I’m making an animation, a computer animation to be precise. When I was very young, TV was still a black and white novelty, movies were shown with short cartoons. Color came to TV and cartoons stopped being shown with movies, becoming a staple of children’s programming in the vast wasteland of television, especially on Saturday mornings.  I was in a child’s animation heaven. How could I not want to make my own?

Fifty years later, I’m finally making a serious attempt to make my own short cartoon. I have no training in drawing, animation, or making movies. I bought a few books, downloaded Blender, and went to work. One of the books I bought is Blender Production, by Roland Hess. It is, as the title suggests, about “creating short animations from start to finish.” I’m following, roughly, the workflow set out in the book with divergences based on my skill set.

I have, I think, reached a milestone of sorts. I believe I’ve finished preproduction and done enough production to start animating. Following the workflow, I have

  • a story that I believe I have the resources to produce
  • storyboards for the key poses in the story
  • a rough sound track for timing
  • a story reel matching the storyboards to the sound track.
  • a character that is modeled and rigged
  • finished sets, except for materials and lighting, although rough sets were called for
  • a first pass master shot reel, with all of the sets, props and characters linked in, and the camera positions blocked

which is to say that I have all of the elements necessary to start animating. I call my shot reel a first pass, because I’m not happy with the camera positions, although I am happy with the set, props, and character placements for the keyframes that match the storyboards.

The book defines three phases of workflow, preproduction, production, and postproduction. Preproduction aims to produce a story reel, in four steps, with some going back and forth between the steps:

  1. Develop a story.
  2. Draw images that match poses at various key points in the story
  3. Record a rough sound track
  4. Use the soundtrack to time when each storyboard occurs.

Production aims to complete all of the animated sequences. There is some going back and forth between steps.

  1. create the objects that make up the scene, props, and characters. In parallel
    1. design, model and rig the character
    2. build rough versions of the sets
  2. make a master scene template file, with all of the objects and keyframes matching each of the storyboards
  3. make scene files from the master template, one per shot, with the objects in place and match the camera angles to the storyboard. You can start this with a rough model of the character that has not been rigged.
  4. record the dialog.
  5. animate
  6. finish the sets, material and lighting. You can do this in parallel with animating.  In fact, Hess suggests that you take breaks from animation to work on this.

postproduction turns the collection of animation sequences into a movie

  1. edit the video and audio together
  2. add sound effects
  3. edit in the music

I diverged from Hess’ workflow in two ways. I can’t draw, having never put the effort into learning how.  I knew that my story has only one character, five stage objects and two props, so I took a risk. I developed descriptions for the storyboards, and rough models of the objects. I then placed the character in the positions matching the descriptions and rendered a single low resolution image at each position.  These became the storyboards. I then built the story reel using the renders as my storyboards.

I strongly caution against doing it this way.  I had a special case, since I knew that all of the objects were going to be used, the roughs would be trivial to produce, and I had to have the character, or I would have no story. It took me less time and effort to do it this way than it would have taken me longer to laboriously draw, badly, the storyboards.


The story

Hess spends an entire chapter on developing a story. Following his guidelines, my story went through three iterations. The first version of the story was very simple: Character walks into a room, notices a light coming from a slightly opened dresser drawer, walks over to the dresser, opens it and receives a surprise. As I worked my way through the details, I conceived a few changes.  The current, and hopefully final, story: open with the character prone in bed. it gets up, walks to the door, opens it, and walks out. Time passes. It returns, walks to the bed, and assumes the opening position. Time passes. This happens a second time. The third time is exactly as the first two, until the character is inside the room and notices the drawer. Instead of going to the bed, the character walks to the dresser, opens the door, and receives a surprise.

I like this version.  The character isn’t memorable, but the action should be within my resources:

  • One character
  • No dialog
  • a single location
  • two props, the door and the drawer
  • three easy to model set pieces, the walls room, floor and ceiling, the bed, and the dresser.
  • three camera positions

The storyboards

I haven’t developed a sense of which poses are important to a story, so I picked poses that represented the end points of actions: the character sits up, moves to the edge of the bed, rises, walks to the door, and walks out of the room. The operations are repeated in the opposite order. The door opens and closes. The drawer opens.

At this point, I have four crude walls, with no window or door openings. They’re just properly shaped blocks. The floor and ceiling are planes. The dresser is another box. The bed, represented by the mattress is another box. The door and drawer are boxes.  It takes fifteen minutes to create the models and place them all on a set. Eventually, I drop the ceiling and one of the walls.  I add a table and chair, to fill the room.  They take another ten minutes to model. I model to a scale of 1 blender unit to 10 inches. The room’s proportions are taken from an old song, the other objects dimensions from various web sites.

The character is harder, but not by much. It consists of ten parts, a head, a body, two upper arms, two lower arms, two upper legs and two lower legs. All of the parts, except the head, are scaled cylinders.  The head is a sphere.

I light the scene with a single overhead hemi. The objects are each given a different color material to help distinguish them. I have enough to make storyboards.

Ignoring the door and drawer for the storyboards, the only thing that moves is the character. For each of the thirteen poses that make up the loop, I place the character in the pose, place the camera, and render an image. I don’t render the poses for the last two positions in the shot.

After I had done the story reel the first time, I reconsidered the poses and prepared a different set of storyboards, simplifying the action. I am going forward with that set of storyboards and story reel.

The rough soundtrack.

My bedroom is approximately the proportions of the set room. I take a cell phone with a voice recorder app and position myself prone on the bed. As I perform the actions, I describe them to the phone. After I make the first pass at the story reel, I realize that announcing the position when it is reached makes for an easier to use sound track.

My bedroom is noisy, mostly due to the fan on my laptop. Once I have the soundtrack I spend five minutes running a noise reduction filter on it in audacity. The waveform will make it easy to spot where to place the key frames.  The second version will make it almost trivial.

The story reel

Following the instructions in chapter 4, I use the Blender’s sequence editor to place the storyboards against the soundtrack. There are still two unknowns: how long between when the character leaves the room and returns; and how long to pause before restarting the cycle. I guess, knowing that I will have to move the second half to match the gap for the first gap. I tweak the loop to be exactly 60 seconds, but doubt that will work. With this loop, I will be able to produce two and one half minutes of animation, by creating around forty seconds of animation sequences. Including titles, credits, and transitions it appears the final animation will be between 3 and half and 4 minutes long. I think I can do this with my resources, including final renders on a single laptop.

Production to the start of animation

As I write this, I have just finished the master shot template and am ready to start animation. I envision two more posts, one at the completion of animation and one at the completion of post processing.

Creating the components

The set pieces and props

I have cheated and already prepared my rough set elements. I divided them into a single “set” file for the walls and floor, and individual files for the bed, chair, drawer, dresser, door, and table. Since I already have roughs, I work ahead. The chair, door and table are already finished, so I just add first approximation materials to them. The bed consists of a frame and a mattress. The original mattress matched the specs for a modern single bed, but it is too high, so I reduce it’s height. I add a few modifiers to make it look more like a sack than a block, although that will need more work. I give it and the frame separate first approximation materials.

The dresser and drawer are harder. The dresser should be hollow and have a front face with four holes in it, matching the openings for the drawers. I decide to use boolean modifiers to hollow out the dresser and punch holes in the face. I encounter a couple of bugs in Blender’s boolean operator, but quickly find workarounds.

The drawer has a front face that is slightly larger in each dimension than the box of the drawer.  It must exactly fit the opening in the dresser. It takes me a while to get the dimensions right and create the box.  I settle on a scaled cube for the face and hollow the box using a boolean.

I add an approximate material to the drawer and a different one to the dresser. I may change them to share a single material before I render.

The character

My original concept of the character was to make it literally a stick figure, with all of the components except the head being made of cylinders with the same cross section. I compromised by making the body have lager dimensions but leaving the arms and legs the same. The rough character has no hands or feet. The idea was to make the character as abstract as possible in an otherwise realistic setting.

The story called for the character to open a door and a drawer. This required adding hands.  A character with hands and no feet makes no sense, so I added feet. My first quick attempt was to use cones. This was a bad idea.

The second iteration, in addition to the cone hands and feet, had all of the proportions wrong. The head was huge, the body shape didn’t work, and the legs were spindly. I tuned the proportions and modeled hands and feet. The hands have no fingers, I have no desire to rig or pose fingers. I replaced the cones with an abstract fingerless hand shape and an abstract shoe without an ankle.

I retained a smaller spherical head. It has no features, in keeping with the abstraction. I have not modeled shoulder sockets, elbow joints, or knee joints. The free floating limbs are meant to convey a sense of abstraction.

A Rigging Rant

Rigging a character is the process of creating controls that can be used to pose the character. For my character, I wanted some fairly simple controls to position the limbs and head. This, naively, sounded easy.

Blender production mentions rigging the character in passing.  A book on character animation includes examples of using a rigged character, but no discussion of how to rig. Two books purporting to cover all of Blender’s tools barely cover armatures, the basis of much rigging.

After much searching, I found a tutorial called Humane Rigging.  It consists of thirty five video segments each discussing an aspect of rigging. I am working my way through it and am at segment 22. It is an excellent tutorial and has convinced me that rigging is one of the hardest parts of animation.

It has taken me hours to put together my simple rig for my character. As I use it to pose the character, I learn that it has many deficiencies, most of which are discussed in the tutorial. I don’t want to spend much time on rigging, so I’m making due with my lame rig.

There are sophisticated rigging tools available. Makehuman is open source and said to be very good. But they have a learning curve that I don’t want to climb as part of this project, so I’m just going to have to suck it up and use my poor rig.

The master scene template

I’ve done two passes on the master screen template, and will probably do one more. The next pass will be to fine tune camera position. It isn’t strictly needed to start animation, though, so I have the luxury of delaying it.

My master scene file started life as a copy of the story reel. I placed the set pieces and props in place and added the rigged character. I made a first pass at placing the roughly posed character into the keyframes and setting up the camera locations. This morning, I added a couple of keyframes that will be needed to avoid problems with tweening, and to refine the interaction between the character and the door.  (Do not walk through the closed door or wall. Do not close on the character.) I carefully posed the character at each keyframe. The locations are right, but most of the poses are wrong, since they have the character standing, but it is more likely to be mid stride at most of those points.

I followed the instructions to put markers at each keyframe, but rather than binding the camera to the markers, I placed keyframes for the camera.  This is where I start to drift from Hess’ approach. I don’t really understand what shot and camera mean in Blender Production, so I’m using only one camera and having it track between the three positions. In effect, I have a single shot in which the camera pauses at certain positions but also moves between them. There are no jump cuts.

Scene/shot files.

Here, I part ways with Hess. The idea of individual shot files is to be able to do the animation in small sections. Since I only have one shot, as I think shot means in Blender Production, this won’t work. I have arbitrarily decided that my shot would be the interval between one storyboard and the next.

I have decided not to create all of my shot files at once, as Hess recommends. I will be doing straight ahead animation, and want each shot to start with the character in the exact pose that the last shot ended in. As I complete a shot, I will create the next shot file. This is a downside of having a single tracking shot. All of the poses are coupled, so each sequence has to begin exactly where the previous one ended.  With separate shots, it is possible to use jump cuts to hide discontinuities, decoupling the shots from each other to a certain degree.

I’m not convinced I’m doing the right thing, but for now, it is what I’m going with.  This may need a revisit later.


There is none.  However, I have started recording various sounds to use as sound effects. Blender production doesn’t really talk about sound design, so I’m on my own here. I have two ideas for background sound, the low hum of an air conditioner that is present until near the end of the animation, and exterior noises that are unheard until the door starts to open, increase in volume until it is open and decrease to unheard as the door closes.

Beyond that, I need Foley effects for footsteps, the door opening and closing, and, possibly, the drawer opening. I have not thought through what sounds will be needed for the surprise.

My initial plan for music is to have a drone sound at 60bpm as an abstract representation of a heart beat. It will move between stereo channels as the character crosses the room. It may decrease as the door closes and increase as it opens the second time. I may not have the resources, though.


I have followed the workflow from Blender Production to the point where I’m ready to start animation. I cheated on the story boards, and am using a different workflow for the animation proper. In addition to animation, I need to design lighting and materials.

I have already started thinking about sound design, which, other than dialog, is post production work. I need background sounds, Foley effects for footsteps, the door and the drawer, and music.

For now, I am ignoring the ending sequence.  I will run it through the process once the loop is done.  I am concerned that I don’t know how to realize the effects I have in mind.

Next up: animation, materials, and lighting.  Stay tuned.