In the previous part of the Panda3D series we created a model of a building. It has the shape of a building, but it’s all gray:
In this part we’ll see how to add materials to objects.
We’ll start by adding a very basic material to the whole building object and then we’ll see how to add separate materials to the particular parts of an object. In the next lecture we’ll make the building look even better by adding textures to it.
A Basic Material
To add a material you should go to the Material tab in the Properties editor. There is no material at this point:
Now click the New button to add a material. Rename it ‘wall’. Now you can see all the different settings that you can tweak:
Click on the Base Color slot (A) to set a base color. Select the Hex tab and enter the hex value of the color: E79A19 (B). Then hit Enter to confirm:
You still can’t see the color on the model because you are in solid shading. To see what it will look like, go to Material Preview shading:
Save the file.
The Wings of the Building
Now we have a basic material for the whole building, but suppose we want to have a separate material for the main part of the building, another for the two wings, another for the windows and yet another for the door. Let’s start with the wings.
Switch to edit mode and select all the faces that belong to the wings. Make sure all faces are selected, including those at the back as well as those in the windows. The easiest way to do it quickly is by switching to wireframe shading (A), going to front view (Num1), face select mode (B) and box selecting the faces:
So, we now want to add a material to the selected parts of the building. In the Material tab (A) we’ll need another material slot for the new material, so click on the plus sign button (B) to add one. Then hit the New button to create a new material. Rename the material ‘wings’ (C). Then press the Assign button (D) to assign the material to the selected faces:
Set the base color to hex 684101. To see the materials, let’s switch to object mode (A), Material Preview shading (B):
Save the file again.
Window and Door Materials
The last parts of the building that we want to handle separately are the windows and the door.
Let’s start with the former. So, go to edit mode, face select mode, wireframe shading (A), left view (Ctrl + Num3) and deselect all. Now carefully (because it’s easy to accidentally select other faces as well) box select the back faces of the windows in the main part of the building (B) and in the wings (C):
Orbit the scene to make sure only the windows have been selected:
Next, let’s assign a new material to the group. With the windows selected go back to the Material tab (A), add a new material slot (B), click New to add a material and rename it ‘windows’ (C). Set the base color to hex 344B4E (D). Assign the material to the selected faces by pressing the Assign button (E). Switch to Material Preview shading (F) and deselect all to see the effect:
Save the file.
And now the door. In edit mode, solid shading, select the six faces that make up the door.
Go to the Material tab (A), add a new material slot (B), press New to add a material and rename it ‘door’ (C). Set the base color to hex 61551B (D) and press the Assign button (E). Switch to Material Preview shading and deselect all:
Save the file again. Now switch to object mode and watch the model:
We could use this model in the game, but why not make it look more realistic? This is what textures are for. We’re going to add textures to our model in the next part.