3D World

Real-time texture painting in Blender

Learn how to use Blender to set up a detailed, layered shader that you can paint in real time

-

Find out how to paint realistic textures with this guide from Sean Kennedy

Ilove the look of grungy, worn sci-fi props, and having recently spent some time brushing up on my hard-surface modelling skills, I wanted to share how easy it is to set up a really good-looking shader in Blender, one that you can actually paint in real time to get the exact look you want.

We’re going to create a basic dirty paint shader and paint on the model directly to reveal the metal underneath. Then we’ll work with the shader nodes so that the painted map can also create an undercoat of a different colour and a bump map. After that, you can just have fun painting all that damage in real time! Finally, we’ll take a look at how easy it is to add painted decals.

Keep in mind this is not a one-click solution, but the basic paint setup is very simple. We’ll be using Blender’s Eevee viewport, which will keep everything real time, and for final rendering, I’d advise using Cycles, which will really crank up the realism.

For this tutorial, we’re just going to focus on the main body of a sci-fi crate, but for the final image, I used the same technique on a few of the other model parts. The goal here is to introduce you to the fact that Blender can paint complex shaders almost as well as any other program out there, and to show you just how easy it is to set up.

01 QUICK AND EASY UV UNWRAPPING

With the main body of the model selected, go to the UV Editing workspace using the tabs at the top of the UI. It should be in Edit Mode automatica­lly now, but if not, simply press Tab. Press A to select everything, then U to bring up the unwrap options. Select Smart UV Project, set the Island Margin to 0.05, and then click OK. You should now see your unwrap appear in the left panel.

02 START CREATING THE SHADER NODES

Click on the workspace for Shading. This is where we'll work on the

shader nodes. With the main body of the crate still selected, press the New button above the node graph to create the shader. Name it something useful like crate_ main_body. Now is also a good time to turn on a helpful add-on for working with nodes. Under Edit> Preference­s>add-ons, search for Node Wrangler and click on the little checkbox to activate it. Then close the Preference­s window.

03 SET UP A PAINT SHADER

This Principled BSDF node is going to be our main grungy paint shader. Click on the swatch next to Base Color to choose your paint colour. Now let’s add some grunge! Download METAL014_4K-JPG from www.cc0texture­s.com, unzip it, and drag the colour image directly into Blender's node graph. It will automatica­lly appear there as an Image Texture node. Connect the Color output from that node into the Roughness of the Principled BSDF node. As you rotate around the viewport, you should see the paint looks a bit more realistic now, but we can still improve it.

04 MAKE IT DIRTY

Create a MIXRGB node by hitting Shift+a>color>mixrgb. Place it close to the Base Color 02 input, then click and drag the Base Color swatch into the Color1 spot of the MIXRGB. Plug the METAL014_4KJPG Color into the Color2 input, then connect the Color output from the MIXRGB to the Base Color input. This will replace the default colour swatch with this new layered colour. On the MIXRGB, change the blend mode to Multiply and adjust the Fac to your liking.

05 BASIC BOX MAPPING

To create better mapping of the METAL014_4K-JPG on the crate, select the METAL014_4K-JPG node and press Ctrl+t. This is a Node Wrangler hotkey to create Texture Coordinate and Mapping nodes. Instead of UV, use the Generated option from the Texture Coordinate node, and in the METAL014_4K-JPG node where it says Flat, change that to Box and set the blend to 0.2. This sets up basic box mapping and blends the corners so there are no hard lines from the texture edges.

06 ADJUST THE ROUGHNESS

Click in an empty area of the node graph, then add a Colorramp node by pressing Shift+a>converter>colorramp. Drag this Colorramp over the node line between the METAL014_4K-JPG node and the Roughness input. When the node line gets brighter, release it and it should plug in automatica­lly between them. Now you can adjust the contrast of the

roughness! Rotate around in the viewport and experiment with the Colorramp sliders. Maybe even change the black one to a grey. Our paint shader is done for now, but you can always come back and tweak or add things.

07 CREATE THE METAL SHADER

Move the Material Output node to the right to make some room to add more nodes, then click in that open area. Press Shift+a>shader> Principled BSDF and drop the new shader node to the right of our paint setup. Hold down Ctrl and Shift and click on this new Principled BSDF node, and it will automatica­lly connect itself to the Material output so you can see it on the model (that's another Node Wrangler hotkey). Turn the Metallic up to 1 and the Roughness to 0.3.

08 ADD PROCEDURAL BUMP

Let's make that metal cooler! Bring in a couple more nodes. Press Shift+a>texture>voronoi Texture, then Shift+a>vector>bump. Plug the Distance from the Voronoi into the Height input of the Bump, and the Normal from the Bump into the Normal of the Principled BSDF. Set the Voronoi Scale to 200 and Bump Strength to 0.03. Much better!

09 SET UP THE MIX SHADER

So we have two separate shaders, and now we have to layer them together and create the image we're going to paint on to show where the paint is scraped away, revealing the metal underneath. Press Shift+a>shader>mix Shader, then connect the paint Principled BSDF to the top Shader input and the metal Principled BSDF to the bottom Shader input. Shift-ctrl click on the Mix shader to see it on the model. The Fac value blends the shaders. Set it to 0, so all you can see is the paint shader.

10 EDGE WEAR IMAGE

Add a new Image Texture node by pressing Shift+a>texture> Image Texture. In this node, click the New button, give this image a name like Edge_wear, set the size to 4,096 x 4,096, leave the colour black, uncheck Alpha, and click

OK. Plug the Color output of this new image into the Fac of the Mix shader. This black image now becomes our reveal matte. We'll be painting on it to reveal the bare metal underneath.

11 INITIAL PAINT STROKES

Switch to the Texture Paint workspace using the tabs at the top. If your model isn’t showing your paint shader here, change the viewport shading by pressing Z and choosing Material Preview. With your new Edge_wear image selected in the Texture Slots panel on the right of the UI, you can now paint directly on your model and see the metal appearing. You'll also see those strokes appearing on the flat image in the left window.

12 CREATE A CUSTOM BRUSH

In the tools panel on the right of the UI, scroll down to find the Texture Mask panel. Click on the New button and rename this new texture Noise brush. Then click the Texture Properties tab (the little checkerboa­rd at the bottom) to access the texture options, select your Noise brush from the dropdown menu if it's not selected already, and change the Type to Clouds. This gives us a procedural noise pattern to paint with. Try it out on the model! It's working, but it's too soft.

13 TEXTURE VS TEXTURE MASK

Make sure the Noise brush did NOT get chosen in the Texture panel right above the Texture Mask panel. If it did, you can clear it by pressing the X to the right of the name. You only want the Noise brush in the Texture Mask panel. Texture Mask uses the image

(or in this case, the procedural­ly generated texture) only as a mask, while Texture actually uses the image or texture as the actual brush, colour and all.

14 SAVE THE PROJECT AND IMAGE

Before we move on, this is important – save the project and the Edge_wear image you are creating! After saving, in the painting tools panel on the right, under the Texture Slots is a button called Save All Images. Press this. Give it a moment to save the image, then hit Ctrl+s to save this project again. Your image will now stay packed with this project. DO NOT forget to press this button as often as you can while you paint to make sure you don't lose work if Blender crashes.

15 DIAL IN THE REVEAL MATTE

Jump back to the Shading workspace and move the Edge_ Wear image node to the left a bit, then create a Colorramp node between the Edge_wear node and the Mix Shader. Drag the two colour sliders on the Colorramp node close together in the middle of the gradient and watch how it sharpens the worn edges on the model. Pretty cool!

16 UNDERCOAT PAINT SHADER SETUP

Between the metal Principled BSDF and the Mix Shader it plugs into, create another Mix Shader with the metal going into the bottom Shader input. Press Shift+a>shader> Diffuse Shader to create a basic diffuse shader, and connect that to the top Shader input. Your metal shader should now be blended with the default white colour of this Diffuse Shader. Change it to black for now (or a darker shade of your paint colour).

17 UNDERCOAT PAINT ADJUSTING

Next, duplicate the Colorramp node after the Edge_wear image

by selecting it and pressing Shift+d. Place this duplicate directly under the first one. Plug the Edge_wear image into this and plug the output into the Fac of the Mix Shader we created a moment ago. Now slide both the colour sliders on this Colorramp to the right and you'll see a dark undercoat layer appear between the metal and paint. You can adjust both Colorramp nodes to get the exact look you want!

18 SET UP EDGE WEAR BUMP

Create a Bump node and plug it into the Normal input of the paint Principled BSDF. Add a Math node using Shift+a>converter>math and plug its Value output into the Height input on the Bump node. Duplicate that Math node with Shift+d, move it to the left, change it from Add to Multiply, and plug its Value into the top Value input of the Add node.

19 DIAL IT IN

Now connect the METAL014_4K-JPG node into the top Value of the Multiply node, and the Color output of the first Colorramp we created after the Edge_wear image to the bottom Value of the Add node. This blends the grunge image and the edge wear image into a combined bump map, but it's a bit crazy right now. Set the bottom Value in the Multiply node to 0.05, turn on Clamp in the Add node, and on the Bump node, turn on Invert and set the Strength to about 0.15. That should look a lot better.

20 HAVE FUN PAINTING!

Back in the Texture Paint workspace, you can now dive in and everything works in real time! Use F and Shift+f to adjust the brush size and strength as you paint. Rightclick­ing brings up the colour palette to quickly switch between black and white. White reveals the metal underneath, black restores the paint colour. Try the Blur brush too. The variation of softer and sharper areas help give it that realistic feel. Isn't it cool how you can see the paint strokes eating through the paint to reveal the metal? Don’t forget to click Save All Images!

21 DOWNLOAD DECALS

Let's add some logos, warnings and markings on the

crate. If you don't have any decal images, there’s a few included in the project download. Since these decals will appear to be painted onto our crate, we have to be careful how we apply the new decal image in the shader nodes. We'll place it at the end of our shader tree, and we'll use the Edge_wear and METAL014_4K-JPG images to make it blend in perfectly. This ensures it will get worn away by all the damage we’ve been painting.

22 CREATE THE DECAL IMAGE

In the Shading workspace, create a new texture image with Shift+a>texture>image Texture. Click New, name it Decal_image, set the size to 8,192 x 8,192, then click on the black colour swatch and set the Alpha to 0 instead of 1. Leave the Alpha checkbox checked and click OK. We're making it 8K instead of 4K for better detail and resolution. After the last Mix Shader in our node tree, add another Mix Shader node and plug the Color output of the Decal_image into the bottom Shader input and the Alpha output into the Fac.

23 THE STENCIL BRUSH

In the Texture Paint workspace, make sure you have the Decal_image selected in the Texture Slots on the right. Mouse over the 3D viewport and press 1 on the numpad to go into orthograph­ic front view. Orthograph­ic views are important for painting decals because the stencil brush is based on the view. Clear your Texture Mask by pressing the X to the right of the name, then in the Texture panel above it, click New. Change the Mapping to Stencil.

24 LOAD A DECAL STENCIL

Go back to the Texture Properties tab and you should see your blank texture there waiting for an image to be loaded. Click on Open, navigate to your decal folder, and select the decal you want to use. Go back to the Active Tool tab and you should see your decal in the Texture slot. When you move your mouse into the 3D view, you should see it appear as an overlay there as well. Click on Image Aspect to automatica­lly set the correct aspect ratio of the decal.

25 PAINT THE DECALS

In the 3D view, right-clicking and dragging will allow you to move the stencil around, holding Shift and right-clicking will let you scale it, and Ctrl and right-clicking will rotate. You can set these manually or reset them using the properties in the Texture panel. Once you've got it positioned in the viewport where you'd like to paint it onto the model, go for it! Don't forget to set the colour you want to use in the Color Picker.

26 WEAR AWAY

Change the decal image or create new decal brushes and keep adding details. Once you've got some decals on, head back to the Shading workspace and put a Math node between the Decal_image's Alpha output and the Fac. Set it to Multiply and plug the METAL014_4KJPG image into the bottom Value of this Multiply node. Put a new Colorramp in there before the image plugs into the Multiply node and you can adjust how worn away you want the decals to appear!

27 EDGE WEAR ON THE DECALS

Duplicate that Multiply node with Shift+d and drop it in line directly after that first one. In the bottom Value, plug in the first Colorramp coming off our Edge_ Wear image. Now you can see the decals only appearing where the bare metal is, so it’s working, but we need to reverse it. Press Shift+a>color>invert and drop this Invert node in line between the Edge_wear image and the Multiply node. Now it’s correct!

28 THINGS TO REMEMBER

This is the basic setup, but obviously you can now make these shaders as complex as you like. Keeping them simple while you do the painting will help keep them real time, though. When you go back to painting more details, make sure you select the correct image to paint on in the Texture Slots panel. I’ve painted on the wrong image more times than I’d care to admit. And whatever you do, DO NOT forget to click the Save All Images button! I can't stress the importance of that enough. •

 ??  ?? 01
01
 ??  ??
 ??  ?? SCI-FI CRATE
Using only a simple setup, we can paint a realistic grungy texture directly in Blender
SCI-FI CRATE Using only a simple setup, we can paint a realistic grungy texture directly in Blender
 ??  ?? A tablet works best Using a tablet will give you both a more natural painting feel and pressure sensitivit­y. 03
A tablet works best Using a tablet will give you both a more natural painting feel and pressure sensitivit­y. 03
 ??  ?? 04
04
 ??  ??
 ??  ?? 07
07
 ??  ?? 06
06
 ??  ?? 05
05
 ??  ?? 09
09
 ??  ?? 08
08
 ??  ?? 11
11
 ??  ?? 10b
10b
 ??  ?? 10a
10a
 ??  ?? 12d
12d
 ??  ?? 12b
12b
 ??  ?? 12c
12c
 ??  ?? 12a
12a
 ??  ?? 20
20
 ??  ?? 15
15
 ??  ?? 14
14
 ??  ?? 19
19
 ??  ?? 17
17
 ??  ?? 18
18
 ??  ?? 16
16
 ??  ?? 21
21
 ??  ?? 23
23
 ??  ?? 24
24
 ??  ?? 22b
22b
 ??  ?? 22a
22a
 ??  ?? 26
26
 ??  ?? 27
27
 ??  ?? 25b
25b
 ??  ?? 25a
25a

Newspapers in English

Newspapers from Australia