Search Knowledge Base by Keyword
- KB Home
- API Reference
- Material Functions
- Mesh Space UVs
On this page:
Introduction
Mesh-Space UV nodes allow full 3D painting by using the UV map(s) of your mesh to project your paint strokes onto a texture. Depending your usecase you may require a lightmap UV on UV1 (see Preparing your mesh for painting) or you may be able to leverage the “fast-path” via Collision UV support along UV0 (static meshes only).
In addition to the base layer, additional nodes suffixed _Layer1 and _Layer2 are available for orchestrating multiple effects that are independent of each other.
Let’s take a look at the available nodes:
Don Mesh Paint UV1
As UV1 in the name indicates, this node requires a lightmap UV on your mesh’s UV1 channel. Seamless painting is supported by this node (for procedural brushes, not for decals). Typically, skeletal meshes will exclusively use this node while static meshes have the option of using Don Mesh Paint UV0 as an optimization (see below).
The Layer1 and Layer2 variants of this node allow you to paint effects on separate layer channels that are fully independent of each other. Each layer will cost you a separate texture though.
R – The red channel of this paint texture
G – The green channel of this paint texture
B – The blue channel of this paint texture
A – The alpha channel of this paint texture. This tells you which parts of the mesh have been painted and which parts haven’t. Gotcha: Because the default paint brush is an Alpha Composite brush, your alpha is inverted! This means the white parts have not been painted while the black parts have. Remember this while blending your effects.
RGBA – A float4 containing all the channels as a single output
For information on packing multiple effects into R/G/B channels see the Packing RGB channel masks article.
Don Mesh Paint UV0
As indicated by UV0, this node uses the default UV channel of your mesh to drive painting. This node requires Collision UV support in your project to be enabled – i.e. “Support UV From Hit Results” (under Project->Physics Settings) and also requires “Trace Complex” to be true (on your Linetrace/sweep).
While it does not support seamless painting or painting on skeletal meshes, it is a valuable part of your toolkit because the performance of this workflow is several times higher compared to a lightmap UV1 workflow, for meshes that need 3D paint projection. As always, for planar meshes or for effects that can be approximated along a plane, the world-space and local-space painting nodes should still be your first port of call.
R – The red channel of this paint texture
G – The green channel of this paint texture
B – The blue channel of this paint texture
A – The alpha channel of this paint texture. This tells you which parts of the mesh have been painted and which parts haven’t. Gotcha: Because the default paint brush is an Alpha Composite brush, your alpha is inverted! This means the white parts have not been painted while the black parts have. Remember this while blending your effects.
RGBA – A float4 containing all the channels as a single output