Blender 2.5 Materials and Textures Cookbook — Save 50%
Over 80 great recipes to create life-like Blender objects
The Blender 3D suite is probably one of the most used 3D creation and animation tools currently in existence.
Also, man-made materials and textures are probably the most used and applied in any 3D environment. The need to simulate created and manufactured objects is therefore an important skill to learn and apply within Blender. Fortunately, the techniques necessary to simulate man-made surfaces are no more difficult than creating natural surfaces.
In this article by Colin Litster, author of the book Blender 2.5 Materials and Textures Cookbook, we will cover
- Creating a slate roof node material that repeats but with ultimate variety
- Using a tileable texture to add complexity to a surface
- Warping a texture to disguise seams in a repeated texture
- Adding weathering by copying and reusing textures
|Read more about this book|
(For more resources on Blender, see here.)
Creating a slate roof node material that repeats but with ultimate variety
Man-made materials will often closely resemble their natural surface attributes. Slate is a natural material that is used in many building projects. Its tendency to shear into natural slices makes it an ideal candidate for roofing. However, in its man-made form it is much more regularly shaped and graded to give a nice repeating pattern on a roof surface. That doesn't mean that there is no irregularity in either the edges or surface of manufactured slate tiles. In fact, architects often use this irregularity to add character and drama to a roof.
Repeat patterns in a 3D suite like Blender can be extremely difficult to control. If repeats become too obvious, particularly when surface and edges are supposed to be random, it can ruin the illusion. Fortunately, we will be employing Blender controls to add randomness to a repeated image representing the tiled pattern of the roof.
Of course, slates like any building material need to be fixed to a roof. This is usually achieved with nails. After time, these metal joiners will age and either rust or channel water to add streaks and rust lines across the slate, often emphasizing the slope of the roof. All these secondary events will add character and dimension to a material simulation. However, such a material need not be complex to achieve a believable and stimulating result.
The preparation for this recipe could not be simpler. The modeling required to produce the mesh roof is no more than a simple plane created at the origin and rotated in its Y axis to 30°. The plane can be at the default size of one blender unit and should have no more than four vertices. That's just about the simplest model you can have in a 3D graphics program.
Position the camera so that you have a reasonably close-up view as shown in the following image:
The default lights will be fine for this simulation. But, you are welcome to place lights as you wish. Please bear in mind that a slate roof tends to be quite a dark material. So, if test renders appear too dark, raise the light energy until a reasonable render can be produced. You can also turn off Raytrace render and Ambient Occlusion, if it has been previously set, as they are not required for this material. This will save considerable time in rendering test images.
Save your blendfile as slate-roof-01.blend.
You will also need to either create or download a small tileable image to represent the pattern of the slate roof. Instructions are given on how to create it within the recipe but a downloadable version is available from the Packtpub website.
How to do it...
We need to create an image of the smallest repeatable pattern of our slates. This can act both as a bump map and also to mask and apply color variation to the material.
The image is very simple and is based on the shape and dimension of a standard rectangular slate. You will see later how the shape can be changed to represent other slate patterns.
This was created in GIMP, although any reasonable paint package could be used. Here are the steps to aid you in creating one yourself:
- Create a new image with size 260 x 420 pixels. I will show later how you can scale an image to give better proportions for more efficient use within Blender.
- Either place guides or create a grid to sub-divide the rectangle into four sections.
- In the top half of the rectangle, create a blend fill from black at the top to white at the middle. Do the same for the bottom half of the rectangle.
- Create a new layer and draw a black line, of three pixels' width, from the middle of the top rectangle section to divide the top rectangle into two.
- Draw black lines of the same thickness on each side of the whole rectangle. If you used a grid, you should find that one of these verticals is two pixels' width and the other one. Obviously, when this image is tiled, the black lines will all appear as equal in thickness.
- Finally, create another blend fill from the bottom of each rectangle from black to white upwards about ten pixels.
- Save your completed image as slate-tile.png to your Blender textures directory.
If you want to skip these steps you can download a pre-created one from the Packtpub website.
How it works...
The image that you want to tile must be carefully designed to hide any seams that might appear when repeated. Most of the major paint packages, such as Photoshop and GIMP, have tools to aid you in that process. However, manual drawing, or editing of an image, will almost always be necessary to create accurate tileable images. Even tiny variations between seams will show up if repeated enough times across a surface. Fortunately, there are techniques available in Blender that will help mask these repeat image shortcomings.
Using a tileable texture to add complexity to a surface
We will use the tileable texture created in the previous recipe and apply it to a slate roof material in Blender.
- Reload the slate-roof-01.blend file saved earlier and select the roof mesh object.
- From the Materials panel, create a new material and name it slate-roof. In the Diffuse tab, set the color selector to R 0.250, G 0.260, and B 0.300.
- Under Specular tab, change the specular type to Wardiso, with Intensity to 0.400 and Slope to 0.300. The color should stay at the default white.
That's set the general color and specularity for the first material that we will use to start a node material solution for our slate roof shader.
- Ensure you have a Node Editor window displayed.
- In the Node Editor, select the material node button and check the Use Nodes checkbox.
- A blank material node should be displayed connected to an output node.
- From the Browse ID Data button, on the Material node, select the material previously created named slate-roof.
- To confirm that the material is loaded into the node, re-select that node by left clicking it.
- With the Material node still selected, go to the Texture panel and in the first texture slot, create a new texture of type Image or Movie and name it slate-tile.
- From the Image tab, open the slate-tile.png image you saved earlier.
- Under Image Mapping/ Extension, select Repeat and set Repeat to X 9 and Y 6. That means the image will be repeated nine times in the X direction and six in the Y of the texture space.
- In the Influence tab, select Diffuse/Color and set to 0.831. Also, select Geometry/Normal and set to -5.000. Finally, set the Blend type to Darken.
Of course, at the moment, the material is no more than a single color with a soft specular shine. To start turning it into a proper representation of a slate roof, we have to add our tileable texture and set up some bump and color settings to make our simple plane look a little more like a slate roof with many tiles.
Save your work at this point, incrementing your filename number to slate-roof-02.blend.
As you can see, a repeated pattern has been stamped on our flat surface with darker colors representing the slate tile separations and a darker top that currently looks like a shadow. This will be corrected in following recipes, along with the obvious clinical precision of each edge.
How it works...
The surface properties of slate produce a spread of specular highlight when the slate is dry. The best way of simulating that in Blender is to employ a specular shader that can easily generate this type of specular property. The Wardiso specular shader is ideal for this task as it allows a wide range of slope settings from very tight, below 0.100, to very widely spread, 0.400. This is different from the other specular shaders that use a hardness setting to vary the highlight spread. However, you will notice that other specular shader types produce a narrower range than the Wardiso shader. In our slate example, this particular shader provides the ideal solution.
Man-made materials are often made from repeated patterns. This is often because it's easier to manufacture objects as components and bring them together when building thus producing patterns. Utilizing simple tileable images to represent those shapes is an extremely efficient way of creating a Blender material simulation. Blender provides some really useful tools to ease the process, using repeats within a material as well as techniques to add variety and drama to a material.
Repeat is a really useful way of tiling an image any number of times across the object's texture space. In our example, we were applying the image texture to the object's generated texture space. That's basically the physical dimensions of the object. You can find out what the texture space looks like for any object by selecting the Object panel and choosing the Display tab and checking Texture Space.
An orange dotted border, representing the texture space, will surround the object.
The plane object used for this material simulation is a square rectangle. If you were to scale the plane disproportionately, the texture would distort accordingly. If we were using this material for a roof simulation, where the scale may not be square, we may need to alter the repeat settings in the texture to match the proportions of the roof rectangle.
In our recipe, we started with a one blender unit square mesh then set the repeat pattern to X 9 and Y 6. The repeat settings have to be integer numbers so it may be necessary to calculate the nearest repeat numbers for the image you want to use. In our example, we didn't need to be absolutely accurate. Slates, after all, are often quite variable in size between buildings.
If you want to be absolutely accurate, scale your original mesh in Object mode to match to the image proportions. So, in our example, we could have scaled the plane to 2.60 (or 0.26) blender units on its X axis and 4.20 (or 0.42) on its Y axis, and then designed our repeats from that point.
eBook Price: $26.99
Book Price: $44.99
|Read more about this book|
(For more resources on Blender, see here.)
Warping a texture to disguise seams in a repeated texture
Slate, when cut, has irregular edges and duplicating this property will provide the observer with a very recognizable clue as to the material the slates are meant to represent. It's also a good idea to add just a little variation to the surface of the slate so that it looks like it has been split from a thicker slate stone. In other words, giving an indication as to how the slate was manufactured.
This recipe naturally follows on from the previous one. If you have not completed that recipe you can download the blendfile from the Packtpub website.
How to do it...
We will start by adding a procedural texture to warp the tiled image texture created at the end of the last recipe.
- Load the file slate-roof-02.blend into Blender.
- In the Texture panel, select the slate-tile texture slot and move the texture slot down one using the down button of the Move texture slots up and down buttons to the right of the texture slots as shown in the following image.
- In the spare slot above the slate-tile texture, create a new texture of type Clouds and name it age-clouds.In the Clouds tab, set to Grayscale and Noise to Soft. Set the Basis to Blender Original with Size 0.60 and Depth 6.
- Under Colors, set the Adjust/Brightness, and the Contrast to 1.300.
- Under Mapping, set the Coordinates to Global, and the Size X,Y,Z to 3.00. The Size setting is important because the texture will map differently between object and global space.
- Under Influence, only select Geometry/Normal and Warp and set them to 2.000 and 0.030 respectively.
Save your work as slate-roof-03.blend and perform a test render. You should see that the slate edges and surface now have a random variation to their appearance similar to that found on real slate tiles. However, their color is still rather light and the slates have no weathering marks. We will create that in the following recipe.
How it works...
Warping an underlying texture, using another texture mapped beyond the object space, is one of the most important ways of masking a repeated texture. Here, we mapped the ageclouds texture to the global co-ordinates, i.e., the world space. When you do this, the scale of the texture will need changing to re-adjust it back to the object space. We can do this approximately by multiplying the scale values by three. So, if you remap a texture to global, the scale reduces by about one-third. This is not meant to be an accurate difference, but in most cases, it will produce the desired affect.
This first texture, mapped to the global space, will warp the following texture across any of its tiled seams. This will give the impression that the repeats are more random as it will help hide any repeating imperfections. We might, after all, want to create several houses in a row and we wouldn't want each roof to be exactly the same. This method of mapping a warp texture modifier, to another co-ordinate system, means the warp will flow across all repeat seams and therefore each roof will look different.
However, this trick can only be used if the object doesn't move in an animation. If it did, the texture mapped to global would appear to stay still as the object moved. There are techniques that can be used to reduce this problem like mapping the texture to an empty parented to the mesh. Then, if the object moves the empty would move with the object and cancel this shortcoming.
Also, the object should not distort during an animation because, again, even if the warp texture were mapped to a parented empty, it's only mapping within the texture space and not directly onto the surface. In those circumstances, it is best to UV map a texture. However, it is possible to bake textures to a UV map and this will be described in later recipes. In our case, a slate roof wouldn't normally move so mapping the warp to global works perfectly.
The warp settings, shown in this recipe, warp the edge of our slate tile to produce a kind of ageing effect. This, together with the normal bump map settings, can be increased to make the tiles appear older. However, the warp setting should not be increased beyond approximately 0.05 as beyond this the warp will be too aggressive and produce an unnatural effect. The normal setting can be increased, to add a rougher surface to the slate, or made to look smooth and new, by lowering its settings.
Adding weathering by copying and reusing textures
In this recipe, we will add some weathering surface attributes by creating another material to represent nail rust running from underneath each slate as though rain has carried it down the roof.
This recipe picks up from the end of the last one. If you have not completed that recipe you can download the start blendfile from the Packtpub website: slate-roof-03.blend.
Open this file in Blender and continue with the following steps.
How to do it...
We first need to create a new material to provide the rust stains that will be applied in the material node tree. The easiest way to achieve this is to temporarily unlink the current material slate-roof from our object to create a new one. The slate-roof material still exists because it is assigned to the node material. Normally, objects can only have a single material assigned, although it is possible to have different materials assigned to vertex groups
In our case, it makes sense to temporarily unlink the slate-roof material, giving a clean slate to create a material to give weather and rust marks to the node material simulation.
- With the roof mesh object selected, and from the Materials panel, unlink the material datablock by clicking the X by the material name. This will not delete the material, just temporarily unlink it from our object.
- Create a new material and name it slate-stains.
- Set the Diffuse color to R 0.39, G 0.41, and B 0.45. Here, we use the default Lambert shader, which is fine for this part of the simulation.
- Set the Specular color to R 0.57, G 0.60, and B 0.62. Make it of type CookTorr with Intensity set to 0.087 and Hardness to 102. The color settings produce a slightly blue specular shine. This is also the default specular shader that again is fine for this simulation.
Now, let us add some textures to produce the weathering required.
- In the first slot of the Texture panel, select the slate-tile texture created earlier. Do this by clicking on the checker icon to the left of the texture name and choose from the list of textures displayed.
- Under the Influence tab, de-select Color. Select Geometry/Norm and set to 5.000. Set Blend to Mix, check Negative, RGB to Intensity, and Stencil.
- In the next free texture slot, create a new texture of type Distorted Noise and name it DistNoise.
- Under the Distorted Noise tab, ensure that Noise Distortion and Basis are both set to Blender Original. Set the Distortion to 1.000, and Size to 0.25.
- Under Influence/Diffuse, check the Color and set to 0.833. Set the Blend type to Mix, and from the color selector, set to R 0.31, G 0.16, and B 0.00.
The next texture will add some more variety to the weathering look we are after.
- In the next free texture slot, create a new texture of type Musgrave and name it Musgrave.
- Under the Musgrave tab, select type Multifractal and set the Dimension to 1.175, Lacunarity to 3.137, and Octaves to 6.433. Finally, set the Basis type to Blender Original with Size set to 0.09.
- Under Mapping, set the Coordinates type to Global.
- Under Influence/Diffuse, select Color and set to 0.297. Finally, set Blend type to Mix, set RGB to Intensity, and change the color selector to R 0.58, G 0.69, B 0.74.
Save your work at this point, incrementing the file name to slate-roof-04.blend, and perform a test render.
The render should only show the effect of this material that produces a nice even slope to each slate with rust-colored stains that only begin from the point where the slates appear to overlap. It's also subtly mixed with some lighter streaking but again avoiding the places where slates overlap because of the stencil mask employed in the first texture.
How it works...
We utilized a method of reusing a texture between materials in this recipe, however, this is not the only method to do this. Blender allows you to copy or reuse textures in more than one way. Some offer the ability to copy and change settings while others will allow you to use a texture as a relative copy so that any changes you make to it, even if it's in another material, will change all occurrences within the blendfile.
In our example, we have used the same texture but in a new texture slot. As a result, we can make changes to the Influence settings separate from the settings in the other material slot. However, if you change the mapping in either texture, these settings will work across both textures. This is useful because we can have different settings for color, bump, or any of the influence attributes while only having to change the repeat setting in one of the image textures of the same name and the other will immediately match.
So, both of our materials share the same tiled image texture but we have added further procedural textures to alter the effect of the overall material to produce a weathered look. The Distorted Noise, and Musgrave textures add the rain and rust stains that once combined with our original slate-roof material will complete the material simulation.
In this article we saw how to create a slate roof node material that repeats but with ultimate variety, use a tileable texture to add complexity to a surface, warp a texture to disguise seams in a repeated texture, and add weathering by copying and reusing textures.
- Blender 2.5: Creating a UV Texture [article]
- Lighting an Outdoor Scene in Blender [article]
- Introduction to Blender 2.5: Color Grading [article]
- Getting Started with Blender’s Particle System [article]
- Advanced Effects using Blender Particle System [article]
eBook Price: $26.99
Book Price: $44.99
About the Author :
Colin is well known in the Blender community for his series of well received tutorials on material and texture creation in Blender. He has extensive knowledge of special effects creation following his early career in the film industry. Colin subsequently went into Higher Education rising to the level of Head of IT and Media Production at a leading UK University.
Colin runs a well known Blender Blog called Cogfilms.com in which he has promoted the development of Blender encouraging users to attempt the impossible in 3D creation.
Colin has been working on a feature film production over the last few years whose title is Cog which is also Colin's internet persona.