Skip to content
Home » Panda3D Part 12 – Texturing the Model in Blender

Panda3D Part 12 – Texturing the Model in Blender

Spread the love

In the previous part of the Panda3D series we added materials to our building model:

building model

If you want it to look more realistic, you might want to add some textures.

We’ll be using five textures altogether: one for the walls in the middle part of the building, one for the walls in the two wings, one for the roof, one for the windows and one more for the door.

I’m going to use the texturehaven.com and textures.com sites where you can download lots of textures for free. You can grab the textures from Github, the link is in the video description. You can see them here:

textures

Download the texture files and make sure they are in the same folder as the blend file because this way the textures can be easily loaded in Blender.

Texturing the Walls of the Middle Part of the Building

Let’s start with the middle part of the building. Before we add a texture, we should UV unwrap the model. This means we should unfold the faces so that they can be spread on a flat surface. To do that, let’s go to the UV Editing workspace:

UV editing

As you can see, we have a 3D Viewport editor on the right, which is in edit mode, and a UV editor on the left where we’re going to spread our model thin. By the way, when talking about textures we use the U and V for the coordinates, hence the name UV editor. This is how we differentiate them from the X and Y coordinates used for the model.

Anyway, first, we have to select the middle part of the building. The simple way to do it is by selecting the wall material in the Material tab and hitting the Select button.

All faces belonging to the middle part of the building have the same material, so they will be selected:

select

And now it’s time to UV unwrap. There are many ways this can be done, but as our mesh has perpendicular faces just like a cube, we can use a special type of unwrapping. In the UV menu select Cube Projection:

UV unwrap

Now you can see the projection in the UV editor:

UV

And now let’s apply a texture image to the selected part of the building. To see what the image looks like, let’s switch to Material Preview shading (A). Then, in the Material tab, click on the little yellow circle next to the Base Color slot (B) and select Image Texture (C):

image texture

Now hit the Open button and select the red_brick_03_diff_1k.jpg image file from the list:

brick texture

Now you can see the image on the walls, but the bricks are too big. In order to change it, we must scale up the projection. As you can see in the UV editor, the walls in the projection are very small as compared with the bricks. This is why they look so weird on the building walls.

Your Panda3D Magazine

Make Awesome Games and Other 3D Apps

with Panda3D and Blender using Python.

Cool stuff, easy to follow articles.

Get the magazine here (PDF).

So, hit A to select all in the UV editor (A) and scale it up (S 7). Now the bricks look much more realistic on the building (B):

brick texture

Here’s what it looks like in object mode:

brick texture

Save the file.

Texturing the Wings of the Building

Next, let’s texture the wings of the building. So, go to edit mode, deselect all and select just the wings of the building. You can select them by material in the Material Properties tab, so go to the Material Properties tab, select the wings material (A) and hit Select (B):

wings

We have to UV unwrap the selected parts of the building using Cube Projection like before. So, with the wings selected, go to the UV menu (A) and select Cube Projection. Then click on the little yellow circle next to Base Color and select Image Texture. Click Open to select an image and select the sandstone_blocks_08_diff_1k.jpg image from the list (B). Then go to the UV editor on the left and click on the drop-down (C) to change the image. Select the same sandstone image you just opened. Then hit A to select all and scale: S 25:

UV unwrap

This is what the wings should now look like in object mode:

wings

Save the file.

Texturing the Roof

Next, let’s add a texture to the roof. But first let’s create a vertex group and a material for the roof. So, go to edit mode, deselect all and select the faces that make up the roof.

Python Jumpstart Course

Learn the basics of Python, including OOP.

with lots of exercises, easy to follow

The course is available on Udemy.

Now go to the Material tab (A), click on the little plus sign button to create a new material slot (B). Then hit New. Rename the material ‘roof’ (C). Finally hit the Assign button (D) to assign the material to the selected faces:

roof

The faces that make up the roof have already been UV unwrapped, so you don’t have to do anything about it. Set Base Color to Image Texture, open the TexturesCom_RooftilesBitumen0020_1_seamless_S.jpg image (A) and change the image in the UV editor to the same roof image. You can do it by selecting the image from the drop-down that appears near the top of the UV editor (B). Select all in UV editor and scale down (S 0.2):

UV unwrap

Here you can see the roof in object mode:

roof

Save the file.

Blender Jumpstart Course

Learn the basics of 3D modeling in Blender.

step-by-step, easy to follow, visually rich

The course is available on Udemy and on Skillshare.

Texturing the Windows

Next, we’re going to texture the windows. Go to edit mode, deselect all and select all the windows by material. To do that, select the windows material (A) in the Material tab and hit Select (B):

windows

Then we have to UV unwrap the selected faces, this time using the Smart UV Project option from the UV menu. So, with the windows selected, go to the UV menu (A) and select Smart UV Project and in the window that opens hit OK. Set Base Color to Image Texture and open the TexturesCom_WindowsHouseOld0341_M.jpg file (B). Open the same image in the UV editor (C):

windows

This time we only need to use just a small portion of the image to texture the window. Let’s use the portion with the window on the right.

Now, we want all windows to have the same texture, so the optimal solution would be to move and scale them so that they are just above the portion of the image with the window. Doing this by hand would be tedious and inaccurate because there are so many windows. But as all the windows are the same size, we can do it in a simpler way.

First, with all the windows selected in the 3D Viewport editor, select Reset in the UV menu (A). This will map the UVs to the entire image, so they will be all at the same position and the same size (B). So, go ahead and reset the UVs:

UV unwrap

Now, select all in the UV editor. Move and scale the islands (this is what we call the UVs that are now stacked on top of one another) so that they are exactly above the right window on the image. While doing this watch the 3D Viewport on the right to see how all the window are being textured simultaneously.

You should end up with something like this:

windows

We’re done with the windows. Here’s what they look like in object mode:

windows

Save the file.

Texturing the Door

Finally, let’s texture the door. This should be a piece of cake for you. Go to edit mode, deselect all and select the door by material (A).

The door is very simple, so you can just select the basic Unwrap option in the UV menu (B), which is the first one in the menu. After you unwrap the door, you will see it immediately in the UV editor (C):

door

Set Base Color to Image Texture and open the TexturesCom_DoorsWoodPanelled0170_S.jpg file (A). Open the same image in the UV editor (B):

door

Select all in the UV editor, move and scale as necessary (A), watching the texture all the time in the 3D Viewport (B). The door image will have slightly different proportions, but don’t worry about that:

door

And here’s the door in object mode:

door

Save the file.

So, now our building model is finished. We’re ready to export it to Panda3D. This is what we are going to do in the following parts.


Spread the love

Leave a Reply