Paint in Editor


DOCUMENTATION

Thank you for using Paint in Editor ❤️

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



How do I upgrade?

First, make sure you back up your project files.

Next, install the latest version.

If for some reason the latest update 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 let me know what the errors are so I can fix it, and revert your project to the previously backed up version so you can still continue working.



Getting Started


Step 1

Select the GameObjects you want to paint.

NOTE  For an object to be paintable, it must either have the MeshFilter + MeshRenderer or SkinnedMeshRenderer or SpriteRenderer component attached.


Step 2

While your objects are selected, pick the Paint in Editor tool.

Step 1  Go to the Scene window.
Step 2  Find the tools floating menu/window.
Step 3  Click the Paint in Editor Tool with the paint brush icon.

This should open the Paint in Editor window.



Step 3

The Paint in Editor window should be on the Paint tab, which shows the current brush settings.

You can then click & drag in the Scene window to paint your object.

TIP  You can scroll the mouse wheel to quickly change the paint brush size.
TIP  You can hold Ctrl and scroll the mouse wheel to quickly change the paint brush angle.


Step 4

Once you've finished painting, you can go to the Objects tab.

On this tab you can see a list of all objects, materials, and textures you're painting.

Next to each material you're painting is the Export button. If you click this, then you can choose where this material will be saved in your project.

Once saved, all textures will be saved alongside the material.

TIP  If you only want to export specific textures, then you can click the arrow to expand a texture, and click the Export button for that individual texture.



Custom Shaders

Paint in Editor is configured to paint most of the shaders that come with Unity.

However, if you add or create your own custom shaders, then you must first create a shader profile for them before you can paint it.


Step 1

If you select your object and go to the Paint in Editor window's Objects tab, you will see an error that there is no Shader Profile for your shader.

If you click the Create button next to the error, then a new shader profile will be created for this shader.



Step 2

Inside the shader profile, you can see a list of all texture names and descriptions that were found in the shader.

On the right side of each texture is the + button, which you can click to reveal a list of texture types.

For example, this shader has the _MainTex texture, which is the albedo/color map, so we choose the Albedo (RGB) Opacity (A) texture.

NOTE  If your shader's texture doesn't match any of the existing texture types, then you may have to create your own texture profile. You can see a list of all the defauult ones in the Plugins\CW\PaintInEditor\Required\Texture Profiles folder. Keep in mind this is quite advanced thing to change and I don't have a tutorial for it yet.


Step 3

Repeat step 2 for any other textures you want to be able to paint in your shader.

You should now be able to paint your object.

NOTE  If your Paint in Editor window is already open, then you will have to go to the Objects tab and click Paint All next to your object's material before you can paint it.



Mesh Analysis

Paint in Editor comes with a tool to analyze the UV maps of your meshes.


Step 1

Select a GameObject in your scene that has a MeshRenderer or SkinnedMeshRenderer.



Step 2

Open the Paint in Editor window.

NOTE  This can be done via the Window/CW/Paint in Editor menu, or by selecting the Paint in Editor tool in the Scene window's toolbar (brush icon).


Step 3

Go to the Objects tab, and you will see a list of all paintable objects you've selected.

Next to each object you will see the Analyze button.

If you click this, it will open the Editor Mesh Analysis window.



Step 4

The mesh analysis will show you the UV map of your object.

The UV map tells the texture where it should apply to your mesh.

If the UV map looks something like this example, where "With No UV" is 0 (or nearly 0), and Overlap % is 0 (or nearly 0), then it should be ready to paint.

NOTE  Grey parts are areas you will be able to paint.
NOTE  Black parts are areas you cannot paint and are wasted texture space. However, for complex meshes it's not always possible or practical to use all of the texture space so it doesn't matter too much if there are large uunpaintable areas.
NOTE  Red parts are areas that overlap, where the same texture pixels are applied to multiple triangles in your mesh. You can still paint these, but applying paint to one triangle will also apply the same paint to all the other triangles sharing the overlapping area.

However, if your mesh has no UV map, little UV map, or overlapping UVs, then it may not be suitable for painting.

If it's not suitable for painting, then please read the next tutorial section on the Mesh Unwrapper.




Mesh Unwrapper

If you read the previous Mesh Analysis tutorial and discover that you mesh may be unsuitable for painting, then you need to UV unwrap your mesh.

Paint in Editor comes with a tool to perform this UV Unwrapping for you in just a few clicks.


Step 1

First, make sure you select your object, open the Paint in Editor window to the Objects tab, and click the Analyze button next to your object.

This will open the Editor Mesh Analysis window.

At the top right of the window you can see the Unwrap button, which you can click to create a Mesh Unwrapper asset.



Step 2

Inside the Mesh Unwrapper asset you can see the Generate button, which will UV unwrap your mesh.



Step 3

After your mesh is unwrapped, you can click the Analyze New button, which will open the Editor Mesh Analysis tool with the newly unwrapped mesh.



Step 4

As you can see, this newly unwrapped mesh is perfectly suitable for painting.

Now you need to go to your object's MeshFilter or SkinnedMeshRenderer component, and change its Mesh setting to use your newly unwrapped mesh.

NOTE  All unwrapped meshes have "(Unwrapped)" added to the end of their names. For example, the "Alien" mesh gets unwrapped into "Alien (Unwrapped)".



Texture Remap

If you read the previous Mesh Unwrapper tutorial, you may notice an issue with some meshes that originally had textures no longer display textures properly.

For example, this is a low poly mesh (left) that has colors based on a texture atlas, and when the mesh is UV unwrapped (right), the texture displays incorrectly. This is because the original texture is based on the old UV map, which no longer corresponds to the new UV map, and so this texture must be remapped with the new UV for it to be used with the new mesh.


Step 1

To fix this, begin by selecting the Mesh Unwrapper asset created in the previous Mesh Unwrapper tutorial.

At the bottom of the inspector for this asset, you will see the REMAP TEXTURE setting, where you can drag and drop your original texture into.



Step 3

You can then see the REMAP WITH MESH setting.

This allows you to select which unwrapped mesh this texture is based on, and you will be prompted to save the new remapped texture to your project.

NOTE  By default, remapped textures will have "(Remapped)" added to the end of their names. For example, the "Alien_Monsters" texture gets remapped into "Alien_Monsters (Remapped)".


Step 4

You can now drag and drop this remapped texture into your material's texture slot, and it should look like it originally did, but now with a UV map suitable for painting.

If your object has multiple textures (e.g. Albedo + Normal + AO), then you can repeat these steps for all other textures.




Custom Paint Brushes

Paint in Editor supports two types of brushes:


Sticker

Stickers are one specific texture like a decal that applies fully each time you click the mouse. For example, a bullet hole texture.



Wallpaper

Wallpapers are tiling/repeating seamless textures that you can continuously paint around your objects. For example, an infinite brick texture.



Brush Textures

Both brush types are defined by a set of textures. For example: Albedo, Normal, Metallic.

The main difference is that Sticker brushes require you to specify an Opacity texture to set the outline, whereas Wallpaper brushes typically don't need opacity.

Albedo  Only the RGB channels are used.
Opacity  Only the R channel is used.
Normal  Standard tangent space normal map.
Metallic  Only the R channel is used.
Occlusion  Only the R channel is used.
Smoothness  Only the R channel is used.
Emission  Only the RGB channels are used.
Height  Only the R channel is used.


Step 1

To create a new brush, you must first create a set of textures, and name them specifically like this: YourBrushName_Type

For example, if your texture set is called RedBricks, and you have an Albedo and Normal texture, then you can add these textures to your project:

RedBricks_Albedo.png

RedBricks_Normal.png

NOTE  These textures can be any format.


Step 2

Once you've added your textures to your project, you must select them all in the Project window.

Then while they're all selected, right click on one and select the Create/CW/Paint in Editor/Brush (Sticker) or Create/CW/Paint in Editor/Brush (Wallpaper) setting.

This will create a new Editor Brush asset.



Step 3

If you named and selected your textures correctly, then the brush should automatically be populated with your texture set.

If not, you can manually drag and drop them in.

NOTE  Sticker brushes require you to set an Opacity Texture, which only uses the RED channel.
NOTE  If a texture slot is null/None/empty, then this brush will not paint any textures of this type. For example, if you don't specify a Normal Texture, then your brush will not modify your object's normal maps.
NOTE  Paint in Editor comes with default textures like Default 0000 Linear, Default 1111 sRGB, Default Normal, etc. This is useful if you want your brush to paint a specific texture type, but you don't have any specific texture for it (e.g. Metallic Texture which is often just black/0000).


Step 4

At the bottom of the brush inspector you can see a preview of your brush. If you like this then you click the Regenerate button next to the Icon setting, then it will save this as an icon alongside your texture set so that you can later find it in the brush browser. You can also manually set the Icon setting if you like.








Assets

Here's a list of all my other assets, please check them out!

You can also view this list on my Asset Store page.

Lean Touch

Lean Touch

Rapidly develop your game with consistent input across desktop & mobile using Lean Touch. This lightweight asset comes with many modular components, allowing you to customize them to your exact project needs!


Lean Touch+

Lean Touch+

Lean Touch+ is an extension to the popular Lean Touch asset, adding many more example scenes.


Lean Localization

Lean Localization

Lean Localization is a localization library that's designed to be as simple to use as possible for both designers, and programmers.


Lean Pool

Lean Pool

Quickly optimize the performance of your games using Lean Pool. Within minutes you can use this lightweight asset to preload, recycle, and limit the spawning of your prefabs.


Lean Transition

Lean Transition

Quickly polish your games using Lean Transition. This asset allows you to easily tween or animate almost anything in your game, making it transition smoothly.


Lean GUI

Lean GUI

Lean GUI is a colllection of components that extend Unity's GUI system, allowing you to rapidly enhance the user experience (UX) of your game's UI.


Lean GUI Shapes

Lean GUI Shapes

Lean GUI Shapes allows you to quickly add lines, rounded boxes, polygons, and much more to your GUI!


Lean Texture

Lean Texture

Lean Texture allows you quickly modify textures in your project with a range of filters, pack them together into channels, and much more!


Lean Texture+

Lean Texture+

Lean Texture+ is an extension to Lean Texture, adding many new types of texture modification tools!


CW Spaceships - Build & Destroy

CW Spaceships

Build your dream spaceship, and then have fun destroying it!


CW Orbit - Modular Backgrounds

CW Orbit

Take your space game to the next level with this collection of 8K background planets. Just drag and drop them in, and enjoy orbiting around them.


CW Nebula - Modular Backgrounds

CW Nebula

Add stunning nebula backgrounds to your 3D space games with ease.


CW Gas Giant - Modular Backgrounds

CW Gas Giant

Add stunning gas giant backgrounds to your 3D space games with ease.


CW Galaxy - Modular Backgrounds

CW Galaxy

Add stunning galaxy backgrounds to your 3D space games with ease.


CW Silhouette - Modular Backgrounds

CW Silhouette

Add stunning silhouette backgrounds to your 3D space games with ease.


CW Cosmos - Modular Backgrounds

CW Cosmos

Add stunning nebula and galaxy backgrounds to your 3D space games with ease.


Paint in 3D

Paint in 3D

Paint all your objects using Paint in 3D - both in game, and in editor. All features are optimized with GPU accelerated texture painting, so you can enjoy consistent performance, even if you paint your objects one million times!


FLOW

FLOW

FLOW allows you to add large scale interactive fluids to your scene - all highly optimized using GPU acceleration.


Destructible 2D

Destructible 2D

Unlock the full potential of your 2D games using Destructible 2D, this asset allows you to quickly convert all your boring solid sprites into fully destructible ones!


Space Graphics Toolkit

Space Graphics Toolkit

Quickly make the space scene of your dreams using Space Graphics Toolkit. This huge collection of space effects can be customized and combined in any way you like, allowing you to quickly make realistic or fantasy worlds. Each feature has been heavily optimized to run on almost any device and platform.


Space Graphics Planets

Space Graphics Planets

Enhance your space scenes using this large pack of high detail volumetric planets. These planets are finished using the powerful planet features from Space Graphics Toolkit (not required).


Volumetric Audio

Volumetric Audio

Unity sounds only emanate from a single point source. This is great for explosions and footsteps, but quite often you need something more advanced. Volumetric Audio is an easy to use package that allows you to define boxes, spheres, capsules, paths, or meshes that sounds can emanate from.






Versions

1.0.4

Updated CW/Common code to latest version.



1.0.3

Improved painting behavior on meshes with overlapping UVs.
Fixed painting starting from wrong coordinate in certain versions of Unity.
Most example brushes now write opacity by default.
Newly created brushes now write opacity by default.
Added new 'Cut' example brush.



1.0.2

Fixed paint brush position on retina displays.
Fixed depth buffer precision on some devices.
Fixed editor slowdown when making some types of meshes paintable.



1.0.1

Added Dilate setting to Config tab.
Added Dilate Steps setting to Config tab.
Exported textures now fully dilate.
Fixed error when compiling for .NET 2.0.



1.0.0

Initial release.







Components

CwEditorDilate

This class allows you to easily dilate the specified mesh texture.



CwEditorMesh

This class processes a mesh so it can be painted in more scenarios than it can be default.



CwEditorMeshAnalysis

This window allows you to examine the UV data of a mesh. This can be accessed from the context menu (⋮ button at top right) of any mesh in the inspector.



CwEditorPaintable

This class handles the current state of each texture you're currently painting in the editor.



CwEditorRemap

This class allows you to remap a texture from one UV layout to a different UV layout.



CwEditorShaderProfile

This object allows you to define what kind of paintable textures are in the specified shaders.


List<string>
ShaderPaths

This shaer profile applies to these shaders.

NOTE  Each shader in this list should have the same paintable textures.


List<Slot>
Slots

The paintable textures that are in the specified shaders.




CwEditorShape

This object allows you to define a texture that can be used as a shape for in-editor painting.


Texture
Texture

The Texture this shape will use.

NOTE  If this texture has an alpha channel, then the Alpha channel of the texture will be used for the shape. If not, the Red channel will be used.



CwEditorTextureProfileAttribute

This allows you to mark a string as a reference to a CwEditorTextureProfile.



CwEditorThumb

This class generates a thumbnail preview texture of a PBR material texture set.



CwEditorTool

This is the custom editor tool used to paint in the Scene view.



CwMeshUnwrapper

This tool can generate UV maps for a mesh that either doesn't have any, or has unsuitable UVs.


Mesh
Source

The original mesh.



Mesh
Output

The unwrapped mesh.



List<Pair>
Meshes

The meshes we will unwrap.



void
AddMesh
Mesh mesh

This allows you to add a mesh to the mesh unwrapper.

NOTE  You must later call Generate to unwrap the added meshes.


static void
Generate
Mesh source, Mesh output

This static method allows you to unwrap the source mesh at runtime.




CwPaintInEditor

This is the main Paint in Editor window. This can be opened from Window/CW/Paint in Editor or from the Scene tab's tool bar by opening the custom tools dropdown and selecting Paint in Editor.



CwPaintInEditor

This class manages the main Paint in Editor window.

This can be opened via Window/Paint in Editor, or from the Scene tab editor tool dropdown's Paint in Editor tool.



Index

Thank you for using Paint in Editor ❤️

How do I upgrade?

Getting Started

Custom Shaders

Mesh Analysis

Mesh Unwrapper

Texture Remap

Custom Paint Brushes



Assets

Lean Touch

Lean Touch+

Lean Localization

Lean Pool

Lean Transition

Lean GUI

Lean GUI Shapes

Lean Texture

Lean Texture+

CW Spaceships

CW Orbit

CW Nebula

CW Gas Giant

CW Galaxy

CW Silhouette

CW Cosmos

Paint in 3D

FLOW

Destructible 2D

Space Graphics Toolkit

Space Graphics Planets

Volumetric Audio



Versions

1.0.4

1.0.3

1.0.2

1.0.1

1.0.0



Components

CwEditorDilate

CwEditorMesh

CwEditorMeshAnalysis

CwEditorPaintable

CwEditorRemap

CwEditorShaderProfile

CwEditorShape

CwEditorTextureProfileAttribute

CwEditorThumb

CwEditorTool

CwMeshUnwrapper

CwPaintInEditor

CwPaintInEditor