Paint in 3D

Thank you for using Paint in 3D ❤️

If you haven't already, please consider writing a review. They really help me out!

If you have any questions, then feel free to send me an E-Mail, or Private Message.

You can also ask in the Forum Thread.

You can also check the YouTube Channel.

I'm also available for freelance work if you need help with your projects.

How do I upgrade?

First, make sure you back up your project files.

Next, install the latest version.

If for some reason the latest updates breaks your project (e.g. errors in the console), then try deleting the root folder for this asset, and reinstalling it.

If it still doesn't work then go back to your previous version, and let me know what the errors are, so I can fix it.

What is Paint in 3D?

Paint in 3D allows you to quickly paint any texture in your scene, using lightning fast GPU acceleration.

All core painting features work in the editor, and in game.

If you just want to paint in game then I recommend you first go through the demo scenes, and read the description text that explains what is being shown and how to set it up.

Are scriptable render pipelines (SRP) supported?

Yes, both LWRP/URP and HDRP are fully supported.

After you've enabled a scriptable rendering pipeline in your Graphics settings:

STEP  1 Go to to the PaintIn3D > Shared > Resources folder.
STEP  2 Select the P3dRenderingPipeline asset.
STEP  3 Click the Switch To Scriptable Pipeline button.
DONE  Paint in 3D has now been converted to use SRP.

If you decide to go back to the standard rendering pipeline, then you can click the Switch To Standard Pipeline button.

Is VR supported?

Yes, this asset has been developed and tested in VR, and supports both multi-pass & single-pass rendering modes.

The VR HVLP demo scene shows you how to implement painting using Unity's XR system.

Getting Started - In Editor

Step 1 - Open Paint in 3D

To open the main Paint in 3D window, click on Window > Paint in 3D from the top menu bar.

Step 2 - Choose an Object

Make sure you're on the Objects tab, and begin by selecting a GameObject in either the Scene window, or the Hierarchy window.

Any GameObject with a MeshFilter + MeshRenderer or Skinned Mesh Renderer is supported by Paint in 3D.

Once selected, you can click the green Lock & Edit button.

NOTE: If you want to paint multiple GameObjects then click the Lock button instead for each of the objects you want to paint.

Step 3 - Choose a Texture

Make sure you're on the Textures tab, and you will see every material and texture slot on the currently locked GameObject.

If the texture slot names look unfamiliar, you can hover your mouse over them to view the material descriptions for them.

Once you've found the texture slot you want to paint, click the arrow to the left to expand it.

NOTE: If you see any info or warning boxes, please follow what they say. Depending on the texture you try to paint, you may see different messages.

Once your texture settings look good, click the green Lock & Paint button.

NOTE: If you want to paint multiple textures on the same GameObject, then I recommend you select a different Group for them. Groups work just like unity Layers, and allow you to limit which paint brushes can paint which groups.
NOTE: If you picked multiple GameObjects, then click the green Lock button instead. You can then click the left and right arrows at the top to cycle through the other GameObjects to set them up.

Step 4 - Painting

Make sure you're on the Painting tab, and you can see all your brush settings.

You can now edit various settings such as the Color and Radius, play around with these to see what they do.

If you move your mouse in the Scene view, you should see a preview of what your brush will look like.

If you click and drag in the Scene view, then paint will be applied to your objects.

NOTE: Keep in mind the painting is done on your live models which are lit. If you paint white on a dark part of the model and see nothing happening, it may be because that part of your model is already white, but only looks a different color due to your scene or material lighting.
NOTE: If you're painting multiple textures on each GameObject then make sure your Group setting matches the textures.
NOTE: If you want to paint multiple brush techniques at the same time, then you can change the Technique setting at the bottom from None to your desired brush style. You can pick up to 4 different paint techniques with one brush.

Step 5 - Unlock

Once you finish painting, make sure you go back to the Objects tab and click Unlock All.

Getting Started - In Game

Step 1 - Make Your Object Paintable

To make your object paintable, first add the P3dPaintable component to it.

This works with any GameObject that has a Mesh Filter + Mesh Renderer, or Skinned Mesh Renderer.

Step 2 - Make a Texture Paintable

Next, you need to mark which textures you want to paint. To do this, click the Add Paintable Texture button from the P3dPaintable inspector.

You should now see the P3dPaintableTexture component.

Inside this component, you can click the dropdown to the right of the Slot setting, allowing you to pick from a list of materials and texture slots.

For most objects, the default 0, _MainTex setting is all you need. But if you have multiple materials or need to do advanced painting you may need to change this.

The rest of the settings should be OK at their default values for now.

Step 3 [Optional] - Clone Your Material

If your object is prefab clone, or your material is shared with multiple objects, then you want to clone your painting material before use.

To do this, click the Add Material Cloner button from the P3dPaintable inspector, and make sure the Index setting corresponds to your P3dPaintableTexture.Slot number setting you want to clone. The material at that index will be shown greyed out at the bottom.

Step 4 - Paint It

Paint in 3D comes with several ways to paint objects.

One simple method is to make a new GameObject with the P3dHitScreen and P3dPaintDecal components. These components will automatically work together, allowing you to paint under the mouse or finger (on touch devices).

You can now adjust the settings for P3dPaintDecal to use the decal texture you want, the color you want, etc.

Once done, hit play, and you should be able to click on your object in the Game window, and have the decal you selected paint on your object.

If nothing shows, make sure your paintable object has a 3D collider (e.g. MeshCollider). Also, make sure the P3dPaintDecal.Texture setting is set, and that the Depth setting is large enough for your model.

For more advanced ways to paint I recommend you examine the demo scenes and see how they're put together!

UV Data Requirements

For Paint in 3D to work, the mesh you want to paint must have UV data. Not only that, but for best results the UV data must not overlap, or exceed the 0..1 range (i.e. no texture tiling).

If your mesh fails any of these requirements, then I recommend you modify the mesh in your favourite 3d modelling program, and unwrap the UV data so that it's suitable for painting.

NOTE: The default Cube and Cylinder primitives that come with Unity fail these UV requirements, so painting them will either not work, or give unexpected results. If you want to paint these shapes then you must create your own custom alternatives that have correct UV data.

What if I don't know how to UV map?

If you don't know how to UV map then you can use Unity to automatically do it for you. Just keep in mind that doing it manually will allow you to achieve better results.

To automatically generate UV data, you can enable the Generate Lightmap UVs setting in your mesh import settings.

NOTE: This will generate UV data in the UV1 (i.e. second) UV channel. Most shaders are designed to use UV0 only.

How can I generate UV0 data?

If you followed the steps above, then you can use Paint in 3D to copy the newly generated UV1 data into the UV0 channel.

To do this, select your mesh in the Project window, and click the context menu (gear) icon at the top right of the inspector, and select the Coord Copier (Paint in 3D) option.

Your Project window should now contain a Coord Copier (YOUR_MESH_NAME) prefab, and you can click Generate to copy the coords over.

The generated mesh with the copied coords is now placed as a child of the Coord Copier prefab, and you can drag and drop it into your Mesh Filter or Skinned Mesh Renderers.

Can I use UV1 data with the Standard shader?

Yes, using the following steps you can get it working using the detail texture. Just keep in mind this isn't the best solution because it doesn't replace the albedo exactly.

Step 1 Change the Secondary Maps > UV Set setting to UV1.
Step 2 Change the P3dPaintableTexture > Slot setting from _MainTex to _DetailAlbedoMap.
Step 3 Change the P3dPaintableTexture > Channel setting to UV1.
Step 4 Change the P3dPaintableTexture > Shader Keyword setting to _DETAIL_MULX2.

How can I use UV1 data with a different shader?

Most shaders only use UV0, so you will need to make an alternative shader that uses UV1.

For example, instead of using uv_MainTex you use uv2_MainTex, or instead of using texcoord0 : TEXCOORD0, you use texcoord1 : TEXCOORD1.

NOTE: Since you're painting using the UV1 channel, you must set the P3dPaintableTexture > Channel setting to UV1.

Runtime Undo & Redo

Paint in 3D supports runtime undo & redo, but to save performance and memory it's not enabled by default.

To enable it, you need to follow these steps:


The first step is to select your P3dPaintableTexture components, and enable the State setting.

If you're painting animated objects then you should set this to FullTextureCopy, but for most scenarios you can use LocalCommandCopy.

If you use the FullTextureCopy state mode then you must also set the State Limit setting. A value of 10 means you can undo paint operations 10 times, and then redo them 10 times. If you paint 11 times with this setting then your initial paint state will be deleted, and you will only be able to undo 10 times to your first paint operation.

You can read the P3dPaintableTexture documentation to understand the difference.

Store States

The next step is to find your painting components, and enable the Store States setting. This setting will automatically call the Store State method on each P3dPaintableTexture in your scene, letting Paint in 3D know that you're about to paint on them.

For example, the P3dHitScreen component has the Store States setting, as well as P3dToggleParticles, and P3dTapThrow.


Finally, you can add the P3dUndoAll and P3dRedoAll components to your UI elements, and they will automatically be set up so when you click them they perform an undo or redo operation.

If you want to manually do this, then you can call the "Undo All" and "Redo All" methods/functions that are on these components. These methods are also available from the context menus if you want to test it in the editor.

And that's it, your game should now have Undo & Redo paint functionality!

Memory Usage

Keep in mind that each undo/redo state is stored as a full texture state. This means that if your texture is 1024x1024 using the RGBA32 format, then each undo/redo state will consume 1024x1024x4 bytes of memory, or 4 megabytes.

If your game requires a lot of undo states and you can't afford to use too much memory, then instead of using this texture state system you need to store the paint operations themselves so you can reconstruct the texture when you undo. This kind of system uses very little memory, but it's quite complex to setup and manage, so there is no implementation of it included in Paint in 3D.

Manual Undo & Redo

The undo & redo functionality listed above works well for most games, but it's not suitable for all scenarios. For example, if you have a multiplayer game where each user can paint their own object, then performing a global undo operation is unacceptable. Another problem is when using delayed painting features like the spray can, the actual paint may not have finished applying by the time you go to paint a second time, and so the save states may seem incorrect.

In these scenarios, you will likely need to manually handle undo & redo. To do this, you need to call the P3dPaintableTexture.StoreState method before you paint a specific texture, and then P3dPaintableTexture.Undo or P3dPaintableTexture.Redo when required. This works the same as the global methods, but because it's done on each individual paintable texture it gives you full control.

Fixing UV Seams

When you make complex 3d models it's inevitable your mesh will have UV seams, where one part of the texture is disconnected from another.

This normally isn't a problem with clever texturing, but when painting it can result in visual seams between these disconnected UV islands (see the seams around the shoulders on the zombie image).

The blue lines in this image show you the UV seams:

How do we fix them?

To fix these UV seams, Paint in 3D comes with a tool that can convert a normal mesh with UV seams into a fixed mesh without UV seams.

To access the tool, select any mesh in your project, click the context menu icon (gear) at the top right, and select Fix Seams (Paint in 3D).

This creates a seam fixer in your project, and automatically sets the Source mesh to the one you picked.

If you want to see the result of the seam fixing, set the Debug Scale setting to 10 or so.

You can now press the Generate button to generate the fixed mesh.

If it was successful, you should see something like this in your Scene window:

Where the green lines are the original seams, and the blue lines are the new fixed seams. The blue lines should be outside of your original green lines. If your blue lines are overlapping then try reducing the Border setting a little, or the Threshold setting.

NOTE: Fixing seams adds vertices to your mesh. If your mesh was already close to the mesh vertex limit then this tool may not work for you.
NOTE: This tool isn't magic. If your original UV map is laid out poorly then this will won't fix it.

How do we use the fixed mesh?

The generated mesh will be placed as a child of the seam fixer in your Project window.

To use it, just drag and drop it from here into your MeshFilter or SkinnedMeshRenderer that uses this mesh.

Blend Modes

Blend modes allow you to change the way your painted pixels are applied to your textures.

If you're painting in the editor, then you can set the blending mode in your brush settings.

If you're painting in game, then you can set the blending mode in the painting components (e.g. P3dPaintSphere, P3dPaintDecal).

Alpha Blend

This blend mode increases the alpha channel of your texture, and blends the RGB channels of your texture toward the color of your paint, based on the opacity of your paint.

Alpha Blend Inverse