Greetings!

Welcome to Scifi-Meshes.com! Click one of these buttons to join in on the fun.

Local TutorialBlender For the Faint Hearted - 07 : Texture Basics

SphynxSphynx195 Posts: 461Member
edited March 2007 in Tutorials #1
Blending for the faint hearted - Sphynx's guide to Blending

Tutorial 7: Texture Basics

In this tutorial, we will be taking one simple texture and using that as an example of how to create, apply and configure a texture on a material. Once we have these basics under our belt, we will them move on and take a look at specific textures, and how they work and are applied.

We won't cover much on the specific textures, as the use and implementation of each could be a tutorial in themselves.

What is a texture?
We pretty much know what a Texture is in relation to a material from an earlier turtorial, but what is it in itself? At the heart of a texture, is the facility to modify the basic, plain appearance of a surface - either by modifying the colouration (via a number of means, not just the basic colour), or by changing its shape.

There are two ways of doing this - by using a bitmap texture, or a procedural texture.

Bitmap Textures
Bitmap textures, often calling 2D textures in Blender, are based upon a source image - whether that image is a Jpeg, GIF, Targa, PNG or another common image format is irrelevant. Once loaded into Blender and applied, the image mapped onto a specified surface. Bitmaps usually utilise either the colour or the tone of individual pixels in the bitmap to modify the underlying material. As a result, the larger the resolution of the bitmap, usually the better the quality of the texture once applied.

Procedural Textures
Procedural textures, also called 3D textures in Blender, are any texture which is created 'on-the-fly' and applied to the material at render time. Procedural textures include any texture that is generated either from 'hard-coded' instructions built into Blender itself, or in the form of plugin scripts. The latter are naturally much slower that the built in versions. Unlike bitmap textures, these textures are mathematically generated based upon the size of the material being covered, and the configuration settings - as a result, the quality of the texture is not dependant upon any 'resolution'. You will always get the best quality for the work at hand, based upon how you have configured the texture.

Procedural textures in the form of plugins are also often used to 'permanently' modify the appearance of a material or mesh as a whole. We won't look at these type of procedural plugins until a much later tutorial however.

Applying our first texture
Load up the last Tutorial scene from Tutorial 6 - the one on which we have assigned a seperate material to one face of our cube. We will use this one face to apply a texture example, so that we can also see the texture in relation to the blue, unmodified surface of the cube. Once you have loaded it, immediately save it again as Tutorial7_00.blend to give us something to start from.

Select the cube, then go to the Shaders panel (F5). Use the '2 Mat: 1' button on this page (it works the same as the one on the Editing panel, in the [Link and Materials] section) to select the 2nd material - our green face.

sb007_001.jpg

For most of this tutorial, we are going to be jumping back and forth between the [Material Buttons] of the Shaders panel, and the [Texture Buttons] (the short cut is F6). Both of these are 'sub-menus' of the Shaders panel (for want of a better word) - the [Material Buttons] icon is a small red ball, while the [Texture Buttons] is what appears to be a small square covered in leopard-spots.

sb007_002.jpg

Lets get started by creating a new texture data-block. On the [Materials Buttons] page, which we have been using so far to create and configure our materials, there is a set of buttons on the far right which so far, we have not used. This section is labelled [Texture], and gives us a direct method from this page of creating a new texture for use on this material - of course, the texture is created in general as well, so we can still use the new datablock with other materials if we want to. Each material can have up to 10 textures attached to it.

You will also see two buttons in this section that also exist elsewhere, but which so far we have not used. They appear to be a black arrow going into an orange block, and the other a black arrow coming our of an orange block. These two buttons are effectively Blender's method of copy-and-pasting data blocks. If you create a datablock that you like and would like to use as a basis for another datablock (one that you have already created - remember, creating a new one will often inherit all of the existing settings anyway), you can use these two buttons to copy-and-paste the configuration into other blocks.

Exercise: Creating our first texture datablock
Click the [Add New] button in the [Textures] pane and a new texture block is created. Much of the information that is now displayed is familiar from using datablocks elsewhere - we get a button allowing us to clear the link to the datablock; a number telling us how many users of the block that there are; a drop down menu allowing us to select an alternate existing block; and of course the datablock name, this time prefixed with the letters [TE] for Texture. In addition however, we also get a little 'tick' graphic next to the texture's slot telling us that not only is the texture attached to the material, but it is also active.

sb007_003.jpg

You will notice however, that now that you have create a new texture link, two new panes have appeared behind the set of [Texture] buttons. These two new panes are labelled [Map Input] and [Map To].

If you hit [F12] now, the scene will render perfectly, but the green face will look unchanged. The reason for this is that while we have created and attached a new texture, we have not actually configured it yet to have any special appearance.


Configuring a texture
There are three things that we need to do in order to configure this texture for use.

First, we need to configure the texture itself, in order to tell it what it 'looks' like - or more accurately perhaps, how it 'acts' as the texture may not just be modifying colour. We will be doing this using the [Texture Buttons] panel. This panel deals with the texture itself, in isolation. What we do here will not have any influence on the material that we attached it to, other than the fact that the texture will ultimately change the material's appearnce. We may attach the same texture to another material however, and it will modify that material in a totally different way with the same settings - why, is explained below.

Secondly, we need to tell the link to the material (note, that this is not a feature of the texture itself) how it is used, or where it's information comes from that it needs to 'act' properly. We do this by using the buttons that we mentioned above, that lie on the [Map Input] pane.

Finally, we also need to tell the link to the material where the resulting information goes to. This might seem obvious, but think - it the material affecting the material's colour, its shade, it energy, it reflectivity or its surface shape, just to name a few? We do this using the final new pane of buttons, labelled [Map To].

You can see therefore, that depending upon what we configure in the [Map Input] and [Map To] panes will allow us to use exactly the same texture to modify two different materials in totally different ways.

Exercise: Preparing a sample texture
For now, lets just put together a simple sample texture to get us started. At this stage, we really want to concentrate on the [Map Input] and [Map To] buttons, and look at specific textures and their uses later.

sb007_004.jpg

Select the [Texture Buttons] icon, or just press [F6]. Let's start off by changing the name of our texture - rename it 'Sample Texture' just so we know what it is. I always find that the default 'Tex' is a bit confusing as it is so short and looks like a datablock prefix. You will notice that all of the texture slots will have their name changed to relect the new texture name as well.

The reason that this texture did not affect our test render is that currently the [Texture Type] drop-down is set to [None]. As a test, choose this drop-down and set the texture to [Noise]. Noise is an extremely useful procedural texture that can be used as the basis for a lot of different effects, but we'll look at this later. More importantly however, there are very few configuration buttons for this texture.

Hit [F12] and take a look at what our green surface now looks like. Not really pretty is it? But, it does show that we have now added a texture to the material and that it is making an impact on the surface appearance. What it does not do, it give us the ability to demostrate some of the features that we need to look at - noise is generated dynamically across the entire surface, so changing the texture co-ordinates and shape of the mapping axis is going to have no affect on the noise texture at all.

sb007_005.png

Just do the next part on trust therefore, and we'll come back to why it works later. Change the [Texture Type] to [Image] and a new set of buttons will appear. From the [Image] pane, select the [Load Image] button and load up a simple, square image. Use the sample 'test.png' file provided with this tutorial if you like - it is just a simple clock face.

sb007_006.jpg

Note: To get the test.png image, just right-click the image and use 'Save as...' to save it down to your file-system.

For now, we are not going to look at any more buttons on this panel. There are some standard buttons, like the colour sliders and colorband buttons, but most of them are highly dependant upon the type of texture being applied. We will therefore look at them more closely when we deal with the different types of texture available.

Switch back to the [Material Buttons] under the red-ball icon, and select the [Map Input] pane.


The [Map Input] pane
The [Map Input] pane is connected with where the texture draws its information from in order to render itself correctly into the material. You could look upon this as a 'first stage' of gathering information so that the texture is 'placed' correctly onto your mesh. There are 5 groups of buttons in this pane, all of then connected with physical placement of the texture.

sb007_007.jpg

Mapping Shape (3D to 2D conversion - images only)
You will notice that in your preview of the material, your image is drawn nice and correctly. In mine for example I get the full clock-face, with a little specularity in the top right hand corner. Hit [F12] and take a look at your image. Not quite what you expect? On mine, I just get a black square - not even the green base colour that the material is set to. Why?

sb007_008.jpg

The reason for this is the set of four mutually exclusive buttons labelled [Flat], [Cube], [Tube] and [Sphere]. At present, the button selected is the default button - [Flat]. This button will orient your image so that the X/Y/Z dimensions of the image match the X/Y/Z dimensions of the mesh. The X and Y are fine (or they would be if the entire mesh were set to display this texture) as the clock face would appear on the top of the cube.

The reason that we get a black face on the side is because the image is repeated 'flat' in the Z direction as the image has no Z depth - the easiest way to think of this is by looking at the side of a book. Each page is effectively non-existant in the Z dimension (forget the fractions of a millimeter for now), so the side of the book takes the colour of all of the pages stacked up on top of each other.

Using 'flat' is fine if we want to map an image to a mesh that is effectively just a flat plane, but otherwise we need to select the best shape to map the image to based upon the rough shape of the mesh being textured.

As we've said already, [Flat] uses the X and Y co-ordinates directly to map the image; [Cube] maps the X/Y co-ordinates to the normal of the faces upon which the image will be displayed (e.g. Apply this to a full cube, each cube gets its own face, perfectly sqaure on); [Tube] maps around Z being a central axis - think of a label on a can of beans; while [Sphere] maps around Z being a central axis, but projects the image outwards 'spherically' - perfect for mapping planets.

Exercise: Trying mapping shapes
Try each of the four buttons with the current texture and render the mesh up with the [F12] key. Don't be concerned if the preview of the material looks very strange when you choose the other buttons - remember that the preview is trying to represent the material in a 2D image. Select one of the other preview shape buttons to get a less confusing preview.

sb007_012.jpg sb007_013.jpg sb007_014.jpg sb007_015.jpg

Take a look at the effects of the different buttons on how the image is mapped. If you want to, try temporarily assigning this material to the entire cube (switch to '2 Mat: 1' and select 'Cube2 Material' as the datablock) and see how the image would be displayed if the entire mesh were selected - just remember to set the rest of the cube back to 'Cube Material' before the next exercise, and changing back to '2 Mat: 2' before you make any more changes to your texture.

Save the scene if you want to, using the next available number.


Mapping Input Co-Ordinates (images only)
I said in the last section that you need to take the results of the mapping shape selected with a pinch of salt. The reason for this is that the orientation of the image or texture is based not just upon the shape that you selected, but also the nature of source co-ordinates that you are using. By default, you will see that the button marked [Orco] is selected - this is short for 'Original Co-ordinates' of the mesh, and will be the type that you use most of all.

sb007_009.jpg

The reason for this, is that this co-ordinate system is linked directly to the mesh. Turn the mesh upside down, and your texture will still be mapped correctly as the co-ordinates system moves with the mesh. There are several other co-ordinate systems that you can use however, that will give you very different results. As some of them are linked to objects other than the mesh, this means tha the texture will move/remain still independantly of whether the mesh moves.

There are various uses for these co-ordinate systems, but they are really something for the individual to investigate and use when they are needed. Remember however that these are all really for bitmap textures - what Blender calls 2D textures. They don't really have any meaning for 3D textures which are generated procedurally.

[UV]
The [UV] system, maps co-ordinates to the UV dimensions. We will talk more of this later.

[Object]
The [Object] button uses a linked objects co-ordinates as the mapping for the texture. There is a text-field next to the [Object] button for you to enter the name of the 'linked' object, but it is not particularly obvious. To try this one, try entering 'Sphere' (the name of our other object) into this field and render the results - because the sphere is much smaller than the cube, you will get an interesting result.

[Glob]
The [Glob] button tells Blender to use the global co-ordinates of the scene for mapping. If you set this type with the clock face, you will get the centre of the clock-face oriented on the ground, as this is where the 'origin' of the scene lies (whereas the cube has it's origin in the centre of the mesh, 1 entire unit above the ground plane).

[Orco]
As already mentioned, [Orco] means original co-ordinates and is the default setting for Blender.

[Stick]
The [Sticky] button uses the object's sticky co-ordinates for mapping - we'll talk more of this later as well.

[Win]
The [Win] button uses the orientation of the window as the source for co-ordinate mapping. What this essentially means, is that the flat 2D image on which the scene is drawn when rendered becomes the source of the co-ordinate system. Render with this set, and the clock-face would appear to be perfectly oriented towards the camera, regardless of which way the cube is pointing.

[Nor]
The [Nor] button uses the normal vector for co-ordinate mapping.

[Refl]
The [Refl] button uses the reflection vector for co-ordinate mapping.

Offsets and Sizes
These are two groups of setting buttons that can be used to modify the offset to the co-ordinates and the size of the texture. The Offset buttons are reasonably intuitive - add 0.5 to [ofsX] button for example, and the centre of the texture is calculated 0.5 to the 'left' of where it would normally be calculated from.

sb007_010.jpg

Experiment with the Size buttons however - they may not work as you expect. Remember that if you set the overall size to 2 times normal, you are not doubling the size of the image. This would be a logical conclusion as we are using a picture of a clock face for our example. Instead however, remember that you are doubling the size of the texture within the same space. The density of the texture is therefore increasing, not the size of the image. Double the density of the texture in the same cube-face therefore, and the clock face will halve in size.

The [X], [Y] and [Z] switch buttons
I have left these buttons for last as they can be very confusing to the uninformed. They are effectively another method of modifying the way in which the co-ordinate mapping system is actually applied to the texture.

sb007_011.jpg

This section consists of three sets of four buttons - [blank], [X], [Y] and [Z]. Unless you have a very specific use for these buttons, they are much better left in their original diagonal configuration of (top down) [X], [Y] and [Z].

These buttons are described as 'switch' buttons, and are used to switch the direction (or even totally turn off) of the texture render. To turn off a particular row altogether, select the [blank] button on the far left of each row.

Under normal circumstances therefore, one row should be set to each of the three dimensions. They should be played with to see the effects that they have - a simple [F12] to render will visually demonstrate what effect each button has. A good example, is to reverse the direction of the diagonal - from the top down, selecting [Z], [Y] and [X]. A render with these settings will effectively invert the image, displaying a mirror image of the clock-face.

Take it slowly however - don't just change everything or you'll get yourself totally confused. Select one row only, and render up a sample with only one button changed. The sample images only use the last row, and have the clock-face texture applied to all faces.

The [Map To] pane
The [Map To] pane is used to how the output of the texture will be applied to the material. Up until now, we have been creating sample renders of the [Map Input] settings using the default [Map To] settings - namely, mixing the texture into the material and affecting only the colour settings. Note that in this case, the 'mixing' of our selected image has effectively replaced the natural green colour of the material totally.

sb007_016.jpg

What the texture will affect
There are 13 different settings of the material that we can tell the texture to influence, all of which can be selected at the same time, or different combinations of each. The [Col] (colour), [Ref] (reflectivity), [Spec] (specularity), [Amb] (ambient), [Hard], [RayMir], [Alpha], [Emit] and [Translu] (translusency) options are obvious ones, as they directly relate to named settings on the material panels themselves.

sb007_017.jpg

The [Nor] option causes the texture to modify the rendered normal of the material. If we used the [Nor] option and re-rendered our sample clock-face therefore, a distinct 'ridge' would be drawn in the material where the image changed from white to black. In some applications, an image used in such a manner is referred to as a 'bump map'.

A special word on how textured influence materials like this should be made at this stage. Usually, the lighter the colour (to a maximum of white) means the smaller amount of influence is made to the material, while the darker the colour (to a maximum of black) the more influence is made. As a result, our black-and-white clock-face used as a 'bump-map' will mean that the black numbers are raised while the white face remains relatively flat.

The [Csp] button influences the colour of the specularity, while similarly the [Cmir] button influences the mirror colour.

The [Disp] button however, while similar in nature to the [Nor], has a direct physical effect on the vertices of the mesh. We can't replicate this in our current scene, as this option usually requires a mesh with a large number of vertices - like a grid plane. A common use for displacement textures is in the generation of terrain.

If you try any of these options, you will notice that [Nor], [Ref], [Spec], [Amb], [Hard], [RayMir], [Alpha], [Emit], [Translu] and [Displ] all actually have three states - off, selected (white) and selected (yellow). In most cases, the second state is an 'inversion' of the first - though that can mean different things to different settings. Experient to see the results of the different applications.

The Colour Selector
Some textures do not provide colour information. Good examples of this are Noise and Cloud. The colour selector in the [Map To] pane can be used to specify what colour the texture should apply to the material. By default, the colour is set to pink - when originally creating a texture, this is a colour that normally you can hardly miss, so it's useful when initially setting up the texture settings.

The 'degree of effect' sliders
There are four sliders grouped together on this page which effectively allow you to set how much influence the texture will have on those aspects of the material that you chose to select. The [Nor] slider for example, allows you to control how big a change in the normal is made by the different colours of our image if we have selected the [Nor] button. Take another look at some of these, and try changing the values on these sliders to see their effect.

sb007_018.jpg

[Dvar]
The [Dvar] slider allows you to set the degree to which mixing takes place between the texture and the material. By default, it is at maximum (1.0). It should be noted however, that this value affects all aspects of the mix other than the colour values.

[Stencil], [Neg] and [NoRGB]
These buttons allow you to set the mode in which the texture will be mixed with the material. They are all toggle buttons, so can all be turned on, off or a mix of both.

The [Stencil] buttons 'stencils' the texture onto the material - For most texture types, this mode will not have much effect.

sb007_019.jpg

[Neg] however, will have an effect on all texture types, and will negate the texture when applied to the material. If applied to our clock-face, all of the black areas will become white, and the white will become black. If 'noise' was applied to our green material (remembering that this does not generate colour, so the default 'pink' will be used for the noise), the material would turn pink and the noise would be green.

[NoRGB] removes all of the colour information from the texture, even if it does provide it. The setting will not affect textures such as 'noise' which do not produce colour information in the first place, but will influence our clock-face. Hit his toggle for the clock-face and the black-and-white information is removed. The clock-face is still drawn onto the cube, but it is now green and pink.

Warp factor 10!
Well, not quite 10 - the maximum is 1 really. The [Warp] toggle tells the texture that it can influence (or 'warp') the texture co-ordinates of the next texture channel in line. The [Fac] slider allows us to tell the feature how much warping can take place - 0 means none, while 1 is the full, maximum setting.

sb007_020.jpg

The Texture Blending Mode
The texture blending mode tells Blender how it should integrate the texture into the material. Up until now, we've been using [Mix], which is the default setting. For a texture like 'noise', the pink dots get mixed in with the green background material. For an image like the clock-face, it does not really make much difference as the entire image has colour information and therefore replaces the entire side of the cube - that is not to say of course, that this will be the same will all images that are mapped to our materials.

There are 9 different blending modes, all of which will be familiar to you if you have used an art application like Adobe Photoshop, Corel Painter or even The Gimp. These are [Lighten], [Darken], [Divide], [Difference], [Screen], [Multiply], [Subtract], [Add] and [Mix].

For example, [Add] adds the values of the texture to the underlying material. In the case of the green colour for example, our clock-face turns a lighter shade of green where the white has been added. Similiarly, [Subtract] does the opposite and our clock-face becomes a very dark green. The best thing to do with these is experiment - most of them a pretty intuitive based upon their name.

The Default Textures
Other than some of the less-obvious settings, I am not going to dig to much into the configuration of each texture. This is not because I don't want to write a huge amount of text, but more because the uses of these textures are really to be explored. While some of these texture have specific names, their use goes far beyond their originally intended purpose. I would really recommend setting up a few primitives and applying each texture in turn to see what they do - then play!

For simplicity, I have just copied these texture images directly from the preview pane. We'll use a lot of them anyway, when we put together our practical tutorial.

Distorted Noise
The default values of Distored Noise texture ensure that it initially looks nothing like its 'noise' namesake. The main difference with Distorted Noise however, is that there can be a range of distortion algorithms applied that make its appearance change. There are all sorts of uses for Distorted Noise is ranging from the more fluid things like water, lava, or lots of other similar looking materials, up to the more jagged and knife edge. It all depends on which distort algorithm you select.

sb007_021.jpg

Distorted noise has only has five settings - The distortion amount (ranging from 0 to 1), the Noise Size (0 to 2), the Distortion Noise algorithm, the Noise algorithm (the underlying base for the noise), and the Nabla value (the offset amount that is used to calculate the Normal). Don't try to understand - just play!

Voronoi
Think of a Voronoi pattern in the same way that loads of bubbles press together in a bath-tub. Where they touch, the walls of the bubbles flatten. The overall texture is therefore made of flat walls, curved surfaces and points where lots of walls meet. OK, an simplification, but you get the idea.

sb007_022.jpg

There are 4 types of Voronoi that you can select - either the base colourless algorithm, or mixtures of a coloured pattern that is quite good for simulating random stain-glass windows. You can configure the pattern using a 'Distance Metric' algorithm, an intensity scale, and a random noise size. There are four 'weighting' sliders that can affect how the Voronoi pattern is drawn, and of course there is also the Nabla slider.

Musgrave
I'm not going to say much about Musgrave at all, other than not to be put off (or indeed, totally confused) by the fact that the default settings for this one display a totally white image in the preview pane.

sb007_023.jpg

Musgrave is a fractal generated noise texture, with 5 different generation algorithms. The setting sliders and similar to those for Voronoi, so I suggest that you play.

Plugin
The Plugin option by itself, is of course not a texture at all. It is simply a means by which you can select a plugin-based procedural texture from your file system.

Noise
Noise is probably the most simple of the procedural textures - there are no configurable parameters, other than the Brightness and Contrast sliders on the colour panel. Even the RGB sliders make little impact to the noise pattern that is generated.

Blend
The blend texture does exactly what its name describes. It allows you to select one of several types of blending machanism between the material colour and the colur that you have selected in the [Map To] panel.

Magic
Magic generates a weird, 60's, drug-induced glass block effect. You can modify the 'depth' of the texture and the amount of turbulence to use.

sb007_024.jpg

Wood
Again, don't let the default settings of this texture confuse you. Initially, the Wood algorithm looks like a simple set of diagonal stripes or concentric rings, depending upon which option you choose. With Wood, you need to start playing with settings to get anywhere useful, and usually need to use several layers of this texture along with a 'noise' generating texture as well, each influencing each other to get a realistic wood effect, but when you do get it right the effect can be exceptional.

sb007_025.jpg

The image below contains two ring pattern textures, a grain texture, and a noise texture.

sb007_026.jpg

Stucci
Stucci simply generates the traditional 'stucci' patterning so familiar on wall tiles. It does not have many settings - three optional algorithms, a toggle between soft and hard noise, a noise and turbulance setting, and the noise generation algorithm.

sb007_027.jpg

Marble
The marble algorithm only has two more settings that 'stucci', and those are a depth for the noise and a Nabla setting. Other than that, the main difference is that this option generates a nice Marble texture.

sb007_028.jpg

Clouds
Clouds is a deceptively useful texture that is the basis for hundreds of uses - not least of which being a good random noise generation texture for use with Wood. You can have the default (greyscale) clouds or colour, soft and hard noise options, a noise size and a noise depth setting. Other than this, there is only the noise alogorithm setting, and a setting allowing you to set the Nabla. Like most of the other textures, the greatest benefit of the texture comes not from these base settings, but how you apply the texture to the material using the [Map Input] and [Map To] panels.

gallery.sph
Post edited by Sphynx on

Posts

  • mookiemookie0 Posts: 0Member
    I am amazed! Great tutorials, great work... WOW! I am just writing a fully proffesional guide for Blender and your work is more than just helpful. In Poland we say - tak trzymać!
  • chupamelrabochupamelrabo0 Posts: 0Member
    Great great great!
    I wish It could be more deep.

    Bah. Thanks, a lot
Sign In or Register to comment.