Tuesday, December 8, 2009

Multiple Materials

Join my Blender 3D forum, where you can network with other Blender friends and get your Blender 3D questions answered.

Many times you will be assigning one material to an entire object. However, there are situations where you want to assign different parts of an object to their own material. The assignment can get kind of tricky. In this demo, we will make each face of a cube have a different colored material. You can then extend this to customize each material, such as changing its opacity or transparency, on each face. You can also add separate textures to each material. This tutorial shows you how to do the first step: creating a separate material for each face of a cube.

1) We'll start with the default 2.49b scene and use the default cube. Press Tab to go to Edit mode. Go to Face Select mode (Control - Tab - 3 or the triangle icon. Press A to deselect all faces. Rotate the cube on its side, to make selecting a face easier. Press Z to go to wireframe mode.

Materials are assigned per face. Each face can have only 1 material ID. New materials are given the next material ID, 2 for the second one, 3 for the third one, and so on. A set of buttons in Edit (F9( assigns multiple material IDs. By default, when you Add New material, all faces have a Material ID 1. Press F5 for the shading buttons. There's an indicator (1 Mat 1) that shows how many materials are on the object (1), and which one we're working on (1).

2) Create 5 new materials. By default, each face of the cube has a material, called Material, assigned to it. The Material button group shows that there is 1 material assigned to the cube. Press F9 to get to the Editing buttons. Press the New key 5 times. Now there are 6 materials, with the names Material, Material.001, Material.002, all the way to Material.005.

3) Assign the faces to their respective materials:
Go to F9 (Editing buttons). Assign the faces as follows:
Select the top face. Set its material to Material (ID = 1). Click Assign.
Select the bottom face. Set its material to Material.001 (ID = 2). Click Assign.
Select the left face. Set its material to Material.002 (ID = 3) Click Assign.
Select the right face. Set its material to Material.003 (ID=4). Click Assign.
Select the front face. Set its material to Material.004 (ID = 5). Click Assign.
Select the back face. Set its material to Material.005 (ID=6). Click Assign.

You can verify which material is associated with which face. Press the A key to deselect all faces. Select a material, say Material.004. Click the Select button and you should see that the material is assigned to the top face. You can also do the opposite. Press A to deselect all faces. Click the bottom face. Click the question mark icon. You should see that Material.001, with material ID 2, is assigned.

4) Click F5 to go to the Shading buttons. We want our materials to have meaningful names so we can identify them easily. Assign the following colors:
Material: Red (R=1, G=0, B=0). Press Autoname to have Blender create a meaningful name (Red).
Material.001: Green (R=0, G=1, B=0). Press Autoname. Blender calls this LightGreen.
Material.002: Blue (R=0, G=0, B=1). Press Autoname. Blender calls this LightBlue.
Material.003: Yellow (R=1, G=1, B=0). Press Autoname. Blender calls this material Yellow.
Material.004: Magenta (R=1, G=0, B=1). Press Autoname. Blender calls this material Magenta.
Material.005: Cyan (R=0, G=1, B=1). Press Autoname. Blender calls this material Cyan.

To view our result, press Tab to go into Object mode. Then go into Shaded mode. Rotate the cube. Press F12 to render.

You can further refine this by changing the characteristics of a material by playing with settings such as Ray Mirror, Alpha, Ray Transparency, the render pipeline, and so on. You can produce some interesting effects. Happy Blendering.