Blender 2.5 Materials and Textures Cookbook
上QQ阅读APP看书,第一时间看更新

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.

Getting ready

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.

  1. Load the file slate-roof-02.blend into Blender.
  2. 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.
    How to do it...
  3. 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.
  4. Under Colors, set the Adjust/Brightness, and the Contrast to 1.300.
  5. 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.
  6. 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 to do it...

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 age-clouds 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.

See also

Chapter 1:

  • Creating a realistic pebble material using procedural textures