Blender addon – Cycles Multi-Tile (udim) non destructive painting

This is a quick starter manual about this add-on. It needs some practices to get use and know how it works.

0. Introduction

1. Installation

2. Prerequisites

3. Set Up

4. Painting

5. Adding texture from disk

6. Filter Layers

7. Saving and exporting

8. Bake layer

 


0. Introduction

 

First thing first: Download from here

In order to improve some characteristics of the 3D painting system in Blender I have created this add-on, which, using characteristics already existing in Blender, creates a ui to mimic a clasic non destructive layered painting as well as adding an accessible way to paint over an Multi-Tile (UDIM) uv mapping like other softwares like Mari or Mudbox does. Of course this is a trick and blender natively does not support that, so does not expect the same result than those other programs, but it is a nice approach.

This add-on works under Cycles using nodes. I have tried to duplicate it in Blender Internal but the node system does not work in the same way and I could not do it. Anyway, for Blender internal we have the classic feature. I just needed use nodes to can create filter layers (adjustment layers) and local filters (clipping mask adjustments).

This is the UI fully open and working. I needed to do many features so the interface is plenty of buttons, I have tried to keep them as similar as other well known painting softwares, but there are many of them needed to achieve the multi-paint functionality.

 

Here a quick starter video is showing a simple workflow

 

Of course, this add-on works with a single uv tile, just disable “Active multiTile” button and you will paint in the selected material. I am going to use a multi tiled model in this explanation because is the more interesting feature.

This add-on requires some advanced knowledge of Blender, so be patient.

1. Installation

As usual, just add the .py file in your add-on folder and activate it in User Preferences window.

01_installation

2. Prerequisites

First we need a model with a uv map layer,  and a single material. Also is a good idea have a node editor area accessible as this is script is directly related to it. Maximum tile grid size is 9×9 tiles.

Also we will need append a couple of node groups which mimic the layer behaviour. We need append those groups before start to painting or the script will not able of doing any layers related operation. Those nodes are included in a .blend within the zip file. We can (and must) do some operations into those nodes, so I prefer keep them as a standard group. You can modified them as you wish (carefully of course).

02_prerequisites_01 02_prerequisites_02

 

3. Set Up

Now we need to create the bunch of materials, one for each uv tile, needed to synchronize the whole system. This is not a real UDIM system, what this add-on does is create a material for every uv tile and then synchronize each other using those layers groups and the ui. When you do something in one material, it will be reproduced in the rest of the materials.

We have to operator to do that: If you want to create an standard material from the scratch just click on MultiTile set. Otherwise if you have an existing material and want to use it as template for the new one, select it and click on Set from selected. Afterwards you can delete the “base” material from the list  because it will not be used for painting any longer.


Notice it creates two new uv layers as well. Do not rename those layers. MTP_BakeLayer is used for baking any layer, MTP_PaintingLayer should be the work in progress layer. During the painting process you will move a lot the uv map, to focus the selected tile to the 1001 position and can do 2D painting, so it is good use this layer as backup.

If you are not using Multi Tile, do not need use any of the previous operators (and they are disabled). But you will need add the two new uv layers. Click on Add UV Layers button and it will create the new two.

03.createTileMaterials_02

Now we are ready to create the first layer and start to paint.

4. Painting

We just need select our shader (in the next image the Diffuse BSDF shader) and click on Create a new PaintLayer. The standard dialog to create new images will pop up and we just need to configure our first image. In this first layer is important activate Connected to Shader. From that moment on, when creating a new layer, we must disable that option.

04.painting_02

Now we will see the first layer added to the node editor, connected to the shader. That layer has a texture and uv map node. We can add whatever node we want in that layer (i.e: a Mapping node in order to modify the uv), just make sure that new node is inside the frame.

Very important. If we want to see the node tree in the UI, we must select any of the layer groups that we have created. So we could have many layer trees (one for diffuse, one for specular, etc) and just need to select one of the node groups to see the whole group in the UI.

 Remember: If you did not append previously the layer node groups, you will have an error like this. Just append those nodes and create again the layer

04.painting_01

 

Next let’s create a new flat color layer. We just need click on the new layer button and deselect “connected to shader”. It will create a new node group. You can notice it does not matter which layer node group is selected, it will show the whole tree in the UI. Besides that, the selected node will be the selected layer in the UI, so it is a bidirectional relation.

04.painting_04

You can paint over those layers normally, and you will paint over the correct texture all the time. Blender is smart and will detect over which material-tile are you painting and it will paint over the correct texture.

Now let’s add a texture mask to the layer. Just click over the correct icon (black and white) and it will add a new mask to the texture. If you want paint over it, just click on the alpha icon in order to swap to mask painting mode. If you want to come back to color painting, click over the coloured circle.

04.painting_05

The rest of the options are the common in this kind of interface. You can delete layer, move up and down, change opacity and blend mode. After moving, deleting, etc. use the sort nodes icon in order to fix the sure mess in the node editor. It will rearrange the node tree.

You can change the uv map for that layer just clicking and selecting in the uv text field. That will only affect to that material-tile, if you want to propagate that change to the rest of the tiles, just click over the chain icon on the right.

04.painting_06

5. Adding texture from disk

If you want to add a texture from the disk in a certain layer, just create an empty new layer and then select it in the proper field. Again, it only will affect to the selected material (because you would not want use the same texture in the head than in the hands, per example). If you want to propagate that texture to the rest of the materials, just click on the chain icon.

05.texture_01

 

6. Filter Layers

If you want to add a texture from the disk in a certain layer, just create an empty new layer and then select it in the proper field. Again, it only will affect to the selected material (because you would not want use the same texture in the head than in the hands, per example). If you want to propagate that texture to the rest of the materials, just click on the chain icon.

 06.filters_01

So, now we have the filter layer, but it does nothing. This is one of the reasons to use nodes. I need go inside the layer group (pressing TAB) and add manually the nodes we want to use. Just make sure those nodes are inside to the Nested Filters Frame.

06.filters_02

You also can add local filters within a color layer (like a clipping mask layer). Just find into it the frame Clipping Mask Filters Frame and add any node in the same way than a filter previously showed.

06.filters_03

7. Saving and exporting

To save every image related to the layers, just click the save button. It will pack the images in the .blend file, so it will increase a lot his weight, but you will not loose any image and will not have hundred of images to manage in disk.

If you want to export (aka save as…) a layer just click export. It will save that layer image of every material. So, if you have 6 materials-tiles, when you click export and select the destination folder, it will save the 6 images.

07.saving_01

8. Bake layer

You can merge every layer below a new one. Ideally when you finish your painting, you would like to create a new layer, bake into it layers below and then export. Afterwards you could delete that layer and keep painting, or delete every layer below and keep painting over it (that would the same behaviour of merge layers).

To do this, just create a new non empty layer with Alpha 0 (fully transparent) and click on Set bake button. It will not bake anything, just will change the uv layer used by that texture to MTP_BakeLayer and will select that one as active uv layer for baking.

 

08.baking_01

Then, with that bake layer selected, use the common Blender’s bake system. If you are just baking the color, use Diffuse Color pass and samples to the minimum (because it does not needs calculate any shadow or reflection). Otherwise if you are baking other kind of pass, like AO or shadows use your favourite cycles configuration.

Click bake and it will take a while. Remember you are baking not only one texture but the number of materials-tiles.

08.baking_02