andyp123 / blender_vertex_color_master

Blender addon for working more precisely with vertex colours.
365 stars 40 forks source link

Vertex Color Master for Blender

Warning: This addon does not work well from Blender 3.2 to 3.6 due to internal changes in vertex attributes in Blender. However, there is currently an 0.9.0 alpha release available that should work with Blender 4.0+. This alpha release has some issues (notably the redo panel) that may be fixed in the future, but I can't make any guarantees due to other commitments.

Users with Blender 3.1 and prior should be fine using the much older 0.8.4 release.

An add-on for Blender that adds numerous features to assist working with vertex colors.

Contents

  1. Installation
  2. Usage
  3. Brush Settings
  4. Active Channels
  5. Data Transfer
  6. Misc Operations
  7. Pie Menus
  8. Planned / Possible Features

Installation

Note: This add-on requires Blender 2.80 or above. There is an older release compatible with Blender 2.79 available here.

  1. Download the latest release from GitHub here.
  2. In Blender, open the Preferences window (Edit>Preferences) and select the Add-ons tab.
  3. Press the 'Install...' button and select the .zip file you downloaded.
  4. Enable the add-on and save preferences if you want it to always be available.

Usage

This add-on is mostly designed for people who use vertex colors as extra non-color data, such as artists making models for games, where such data can be useful for creating interesting shader effects, or for storing baked light data. The tools provided by this add-on allow the user to fill, invert, posterize or remap individual color channels, as well as copy or swap channels between layers and exchange vertex weight and UV data to and from color channels.

One of the key features of the addon is its isolate workflow, which allows the user to isolate a single channel (R,G,B or A) of vertex color data and work on it using all the usual vertex paint tools. The data transfer features can then be used to pack different vertex color data into single channels, with the remap and posterize functions helping to ensure the data is in specific ranges.

The add-on will appear in the details panel (press 'n' to open) to the right of the 3D view when in vertex paint mode as shown in the following image.

Vertex Color Master UI


Brush Settings

Brush settings contains a few of the most useful brush options so that the add-on can be open and useful without needing the full brush menu to be open. This way there is more space in the Tools panel, even on smaller displays.

Color Picker

The primary and secondary brush colors are shown here. Press the button on the right to switch between them. Value sliders are shown when the 'Use Grayscale' option is enabled. Note that you can also press the 'X' key to switch between the primary and secondary colors.

Fill With Color / Fill With Value

This will ignore any selected active channels and fill the mesh with the current brush color. It can use the selection mask mode, so this is a handy shortcut for filling selected faces or vertices with a specific color instead of trying to set the value via channels or painting.


Active Channels

The active channels section allows the user to enable or disable channels that the functions directly under the active channels will work on. For example, enabling only the R channel will mean that it is the only channel to be affected when the Invert button is pressed, etc. Different combinations of RGBA can be selected by holding the shift key while clicking on the channel buttons.

As channels are activated and deactivated, the brush color will update to match them. If the Add or Subtract brush blending modes are set, this enables the user to paint only on active channels quite easily.

Note: At the time of writing, Blender 2.80 does not support rendering or painting with vertex alpha, but the alpha values are stored in the vertex color data correctly. This will hopefully be improved in the future, but for now, alpha data can be edited or viewed by isolating the A channel.

Isolate Mode

Isolate Active Channel

When a single channel is selected, the option to isolate it and work in grayscale mode becomes available. Simply press the 'Isolate Active Channel' button and the active channel will be isolated and the Vertex Color Master UI will change to reflect this. Once in isolate channel mode, the UI will change to reflect this and the color picker will change to grayscale value sliders. Once changes to the channel have been made, they can be applied by pressing the 'Apply Changes' button, or discarded by pressing 'Discard Changes' instead.

Fill / Clear

Fill sets the value of the currently active channel(s) to 1, whereas Clear will set it to 0.

Invert

Inverts the value of the currently active channel(s).

Posterize

Posterize the value of the currently active channel(s). Useful for cleaning up channels where the value should be 0 or 1, or otherwise snapping the value to increments determined by the number of steps.

Remap

Remap the value of the currently active channel(s). This function takes values in the active channel and scales them based on an input range and output range. It's somewhat similar to using levels in a 2d graphics package, so it can be used to adjust the minimum and maximum brightness, invert etc. If used on individual channels, it can be used to shift colors apart.


Randomize Mesh Island Colors Per Island (Islands on UI)

All separate parts of a mesh (islands), will be assigned random values per active channel based on various randomization parameters.

Data Transfer

This section allows quick transfer of data between different color layers, vertex groups and uv layers on the same object. Values can be transferred between 'Src' and 'Dst' layers. When using a vertex color layer, the RGBA channel will be selectable from the channel dropdown on the right. If a vertex group is selected (vertex groups are prefixed with 'W:', for weight), the channel dropdown will be disabled. If a UV layer is selected (UVs are prefixed with 'UV:'), channels will not be selectable at all.

Depending on the type of data selected in either 'Src' or 'Dst', a different operations will be available from the UI. If vertex groups or UVs are selected in either 'Src' or 'Dst', a different UI will be shown that enables only simple data transfer. Transfer between two vertex groups, uv layers or vertex groups and uv layer is currently unsupported.

Copy / Swap

Copy data from the 'Src' layer/channel to the 'Dst' layer/channel. Using swap will swap the data instead of copy.

Blend

Blends the 'Src' channel with the 'Dst' channel and puts the result in the 'Dst' channel by default.

Src RGB to Luminosity

This calculates the luminosity of the vertex color data in the 'Src' layer and puts the value into each of the RGB channels.

Src to Dst RGB

Copy the value of the 'Src' channel into all channels of the 'Dst' layer.

Weights to Dst

Copy the weight value of the vertex group in the 'Src' layer to the 'Dst' channel.

Src to Weights

Copy the value of the 'Src' channel to the vertex group in the 'Dst' layer.

UVs to Color

Copy the weight value of the uv layer in the 'Src' layer to the 'Dst' channel.

Color to UVs

Copy the value of the 'Src' channel to the uv layer in the 'Dst' layer.

Normals to Color

Copy the object space normals to the 'Dst' color layer (XYZ > RGB).

Color to Normals

Copy the 'Src' color layer to the custom mesh normals (Requires object space normals, RGB > XYZ).


Misc Operations

The 'Misc Operations' section contains features unrelated to the main features of the addon.

Blur Channel Values

Blurs the values of all the vertices in the mesh to smooth them out. It uses the smooth weights function available in weight paint mode, but allows it to be used interactively on vertex color channel data. Note: This feature is currently only available when a channel has been isolated.

Randomize Mesh Island Colors

All separate parts of a mesh (islands), will be assigned random colors based on various randomization parameters.

Adjust HSV

Enables modification of the Hue, Saturation and Value of vertex color data using Blender's built-in HSV adjust function.

Brightness/Contrast

Enables adjusting the brightness and contrast of the vertex colors using Blender's built-in Brightness/Contrast function.

Dirty Vertex Colors

Uses Blender's built-in Dirty Vertex Color function to darken the vertex colors based on the curvature of the mesh. This is useful for generating fake ambient occlusion, and can be adjusted using either Brightness/Contrast or Remap to create a more pleasing result. Note that the vertex colors should be set to white before applying this effect, as it is applied over the top of existing colors.

Linear Gradient

When enabled, the gradient tool allows you to draw a line representing the start and end of a gradient in the 3D view. Once the line has been drawn, a gradient will be painted onto the mesh. The brush primary and secondary colors are used to set the gradient colors.

Circular Gradient

The circular gradient tool is similar to the gradient tool, but draws a radial gradient, with the center at the first position clicked, and edge at the second.

Note: Circular gradient uses the same underlying operator as the Linear gradient, and so has the same options.


Pie Menus

Most of the features of the addon can also be accessed from a pie menu that is bound to the 'V' key. The pie menu appears as shown in the image below.

Standard pie menu

When in isolate mode, the pie menu is slightly different, as shown in the following image.

Isolate pie menu


Planned / Possible Features