In this tutorial I'll try to show you how to use two different conventional materials and apply them to different parts of the same object. A control-"texture" is used to define where each material shows up.
- Conventional materials in Blender define how an object looks by laying several (up to 8) image-layers with different functions over each other onto the surface of the object.
- Node Materials go one step further and use these conventional materials (and some additional functions) to make even more complex (or in quite some cases simpler) materials.
This tutorial is heavily inspired by the following tutorial:
Another link to a thread in the blenderartist forum shows the same technique, but more complex:
Prepare the Scene to use Node Materials
The first thing to do is to split the main window so it has a similar layout as pictured in the image. This means you need one window showing the button area, one with the 3D View and one with the Node editor
Read a more detailed version on how to activate node materials in Manual/Node Materials.
Now we press the Nodes toggle next to the MA:Material field. The MA: field should now show something like NT:Material instead and the Node Editor window should now be filled with two little widgets (in Blender referred to as Nodes).
I suggest to rename the NT:Material to something like NT:mixed to indicate that this node material will later be a combined material.
Currently there should be two nodes in the Node editor. One Material input node and one Output node.
Since we want to mix two materials we now add a second material node by pressing ⇧ ShiftA -> Input -> Material
Create two conventional materials
For this tutorial we will create two very basic materials that get combined later on because it's faster and easier to explain. When you finished this tutorial you could try to replace them with others (maybe from a material library) and see what you can achieve.
In the first material node is a red button labled Add New. Press it.
The node should now show a plain grey material, as well as the Button area below.
We now select a color (i'm using red) by clicking on the grey field next to Col.
I also suggest to change the material name by either clicking into the MA: field in the material node or the MA: in the Button area (marked in the image) and entering the new name.
Select the second material node and repeat the steps from the first one.
Repeat the steps from the red material, but with another color (I'll use blue here)
Use the magic of Nodes to mix the Materials
We can finally start to combine our two created conventional materials via the material mode editor.
For this we add a Mix node by pressing ⇧ ShiftA -> Color -> Mix.
Now we connect the output sockets (Color) of the two materials to the input sockets (Color1 and Color2) of the Mix node and the output socket of the Mix node to the input socket (Color) of the Output node. This is shown with the yellow arrows in The connected Mix node.
You should get a result as shown in The connected Mix node.. Now you may ask "Why is it violet? I want it to be part red, part blue." The explanation is simple. We haven't defined the correct factor Fac: for the mix yet.
The Mix node mixes the colors like this:
- Fac: 0.0
- The first color is displayed. The second one is basically ignored.
- Fac: 0.5
- The 1. and 2. colors are mixed 1:1 for each rendered point. In out case a mix of red and blue produces violet.
- Fac: 1.0
- The second color is displayed. The fist one is basically ignored.
- Grayscale input linked to Fac:
- A grayscale (value-map) map is used as a factor for the mixing of the input colors. For each point a value is taken from this map (0.0 - 1.0) and produces a result like the 3 cases above, but limited to this point only.
Read more about the Mix node here: TODO: link
This leads us directly to the next step: Adding a texture map to be used as a grayscale input for the Mix factor.
To do this press ⇧ ShiftA -> Input -> Texture.
The next step is unnecessarily complicated (in Blender 2.42a and if I didn't miss anything) since we cannot load a texture from the Nodes Editor window. A texture is loaded by adding it to an existing material and then unlinking it for the texture node to use.
For this we temporarily switch the Buttons Area to the Texture buttons by pressing F6 until the Texture panel appears in the area.
There should be a lot of empty rows there. They all belong to the Material that is currently selected (or which was last selected).
Now press the Add New button in the Texture panel and rename the texture from TE:Tex... to something like TE:mask.
Important: We now unlink this texture from the material by clicking on the small X next to TE:mask. If you don't do this the texture will later show up in the material itself, and not only as a mask for the node.
We now select the created texture in the Texture node by clicking on the small arrow icon (dropdown) and select it by name (in my case mask).
We now select the texture node in the node editor. The Buttons area (still in Texture buttons mode) should now display a single dropdown menu labled Texture Type.
Select it and choose Blend from the list. A black-to-white gradient should show up in the preview panel and the Texture node.
As a final step we connect the Color output socket (not Value output socket, image is incorrect) of the Texture node with the Fac: input socket of the Mix node.
Download the .blend file here: Tutorial-Mixing Materials Nodes.blend
Using different Texture Types
Using colorbands for the texture
Changing the mapping of the texture
TODO: My knowledge of the mapping nodes is somewhat lacking. maybe s/b wants to jump in here? text-descriptions would be enough. I'll provide screens if needed.