Paint Functions


Search Knowledge Base by Keyword

You are here:

On this page:


1. Paint Stroke

For most users, this is the only node you’ll ever need.

Simply pass in a HitResult from your gampeplay or player interaction and this will render an effect for your Hit Location.

To actually receive the effect inside your materials, you’ll need to use one of the material functions provided by the plugin (see Choosing the right UV workflow for your Mesh).

Depending on which material function you choose, your stroke may be rendered onto a single texture (shared world space painting) or onto a unique texture for each mesh in your actor (mesh space / local space painting).

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintStroke
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Hit Any Hit Result from collision impacts, mouse/cursor hits (projected to world) or any other source.  FHitResult
Brush Size The radius of your paint stroke measured in World Space units.
The actual brush size rendered is UV Island dependent in some secnarios such as decal/text projection in a mesh-space UV workflow.
 float
Brush Color  The color of your brush stroke.  FLinearColor
Brush Decal Texture Optional Decal. The decal texture is expected to have the decal in RGB and the decal mask in its Alpha channel.

Both can be used inside your material for specific effects. 

 UTexture2D*
Paint Layer Paint Layers are used to drive multiple effects that are independent of each other. Each paint layer is a unique texture onto which a single effect may be painted as RGB with an Alpha mask (or even multiple effects with individual R, G, B channel masks). A primitive can accommodate multiple paint layers for each material that are all independent of each other.  int32
Collision Tag  Use this to encode your paint stroke with a special collision tag that you can read back later to drive gameplay decisions, custom collisions, etc
You will need to pass the same value back to the QueryPaintCollision (url) node to check whether a particular location has been painted/tagged.
FName
Brush Opacity  The opacity of your paint stroke  float
Brush Hardness The hardness of your paint stroke, 0 = Soft, 1 = Hard  float
Brush Decal Rotation The rotation of the decal projected onto your mesh. For Mesh UV workflows rotation of your UV Island may influence actual rotation.  int32
Brush Render Material Defaults to “M_PaintBrush_Regular” which is an AlphaComposite brush meaning the RGB contains your paint/decal while the Alpha accumulates your paint mask & opacity. If you’re looking to pack R, G, B channel mask effects, just set this to the “M_PaintBrush_Regular_Additive” material provided in this plugin’s Content folder.

Most users will not need to create their own render brush, but you can do so if desired.

 UMaterialInterface*
Allow Duplicate Strokes Important for Decals, Gameplay effects, etc! By default the plugin allows you to keep accumulating or overwriting paint strokes on a single region.  Sometimes, however it is desirable to prevent players from being able to repeat a stroke on a location that has already been painted. Set this to false to achieve that. Eg: Painted Gameplay Items (like traps), Portal effects (eg: Exploding floors that leave holes behind them), Character Decal Tattoos that should only appear once, etc.  bool
Collision Inflation Scale Scales the paint collision associated with this stroke. Useful for Masked materials where your material’s “Opacity Mask Clip” affects perceived collision. As many collidable effects like Portals tend to use soft brushes or low opacity clip masks (to allow for crater WPO effects, etc to be visible…), the size of the observed hole/collision perceived by the player is potentially _smaller_ the actual brush size (collision size) at which you painted the portal!  float

 


2. Paint Stroke At Component

While Paint Stroke requires you to supply a Hit Result, there are times when you already know exactly what component to target and just want to apply an effect at a pre-determined location. Use Paint Stroke At Component for that.

This is great for orchestrating effects; Eg: when a character walks over a Lava trap you can splash the character’s legs with Lava (the sample project has this very example in it!)

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintStrokeAtComponent
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

Primitive Component The primitive onto which you desire to paint an effect. Typically a skeletal mesh or a static mesh.

For direct landscape painting the “Paint World Direct” node is recommended for ease of use.

 UPrimitiveComponent*
Relative Location The _relative_ location on your mesh for this paint stroke. Ignored if SocketName is also set. Hint:- This is a relative space, not world space location. FVector
Socket Name Specify a socket instead of relative location. Convenient for targeting specific limbs or body parts directly.

Note:- Socket must be accurately placed at the desired part of your mesh for the effect to be rendered precisely.

FName
Brush Size The radius of your paint stroke measured in World Space units.
The actual brush size rendered is UV Island dependent in some secnarios such as decal/text projection in a mesh-space UV workflow.
 float
Brush Color  The color of your brush stroke.  FLinearColor
Brush Decal Texture Optional Decal. The decal texture is expected to have the decal in RGB and the decal mask in its Alpha channel.

Both can be used inside your material for specific effects.

 UTexture2D*
Paint Layer Paint Layers are used to drive multiple effects that are independent of each other. Each paint layer is a unique texture onto which a single effect may be painted as RGB with an Alpha mask (or even multiple effects with individual R, G, B channel masks). A primitive can accommodate multiple paint layers for each material that are all independent of each other.  int32
Collision Tag  Use this to encode your paint stroke with a special collision tag that you can read back later to drive gameplay decisions, custom collisions, etc
You will need to pass the same value back to the QueryPaintCollision (url) node to check whether a particular location has been painted/tagged.
FName
Brush Opacity  The opacity of your paint stroke  float
Brush Hardness The hardness of your paint stroke, 0 = Soft, 1 = Hard  float
Brush Decal Rotation The rotation of the decal projected onto your mesh. For Mesh UV workflows rotation of your UV Island may influence actual rotation.  int32
Brush Render Material Defaults to “M_PaintBrush_Regular” which is an AlphaComposite brush meaning the RGB contains your paint/decal while the Alpha accumulates your paint mask & opacity. If you’re looking to pack R, G, B channel mask effects, just set this to the “M_PaintBrush_Regular_Additive” material provided in this plugin’s Content folder.

Most users will not need to create their own render brush, but you can do so if desired.

 UMaterialInterface*
Allow Duplicate Strokes Important for Decals, Gameplay effects, etc! By default the plugin allows you to keep accumulating or overwriting paint strokes on a single region.  Sometimes, however it is desirable to prevent players from being able to repeat a stroke on a location that has already been painted. Set this to false to achieve that. Eg: Painted Gameplay Items (like traps), Portal effects (eg: Exploding floors that leave holes behind them), Character Decal Tattoos that should only appear once, etc.  bool
Collision Inflation Scale Scales the paint collision associated with this stroke. Useful for Masked materials where your material’s “Opacity Mask Clip” affects perceived collision. As many collidable effects like Portals tend to use soft brushes or low opacity clip masks (to allow for crater WPO effects, etc to be visible…), the size of the observed hole/collision perceived by the player is potentially _smaller_ the actual brush size (collision size) at which you painted the portal!  float
Draw Debug Location Useful for visualizing exactly where the system is attempting to add paint. Use this for debugging your socket / relative location accuracy.  bool

 

 


3. Paint World Direct

Context-free world-space painting along any two axes. This node paints a shared world-space texture along XY or XZ or YZ directly, without the need to specify an actor or primitive as a context.

Typically used for driving Global Effects like Fog-Of-War systems. Can also be used for direct landscape painting if you’re trying to orchestrate a predetermined effect and just need a quick way to paint a world-space aligned texture.

For Blueprint users:-

  • This node is available in the “Don Mesh Painter” category on your context menu.
  • Expand the dropdown at the bottom of the node to view all parameters

For C++ users:-

  • This function is available in UDonMeshPaintingHelper::PaintWorldDirect
  • #include “DonMeshPaintingHelper.h”

 

Param

Description

Type

World Location The world location onto which paint is to be accumulated (and potentially used by several interested actors/effect-systems/materials). FVector
World Axes WorldAxes – Choose from XY or XZ or YZ axes for accumulating paint. Because this is planar mapping, you only control two axes; Eg: Painting on XY you lose control over Z axis, i.e. world height.  EDonUvAxes
Brush Size The radius of your paint stroke measured in World Space units.
The actual brush size rendered is UV Island dependent in some secnarios such as decal/text projection in a mesh-space UV workflow.
 float
Brush Color  The color of your brush stroke.  FLinearColor
Brush Decal Texture Optional Decal. The decal texture is expected to have the decal in RGB and the decal mask in its Alpha channel.

Both can be used inside your material for specific effects.

 UTexture2D*
Paint Layer Paint Layers are used to drive multiple effects that are independent of each other. Each paint layer is a unique texture onto which a single effect may be painted as RGB with an Alpha mask (or even multiple effects with individual R, G, B channel masks). A primitive can accommodate multiple paint layers for each material that are all independent of each other.  int32
Collision Tag  Use this to encode your paint stroke with a special collision tag that you can read back later to drive gameplay decisions, custom collisions, etc
You will need to pass the same value back to the QueryPaintCollision (url) node to check whether a particular location has been painted/tagged.
FName
Brush Opacity  The opacity of your paint stroke  float
Brush Hardness The hardness of your paint stroke, 0 = Soft, 1 = Hard  float
Brush Decal Rotation The rotation of the decal projected onto your mesh. For Mesh UV workflows rotation of your UV Island may influence actual rotation.  int32
Brush Render Material Defaults to “M_PaintBrush_Regular” which is an AlphaComposite brush meaning the RGB contains your paint/decal while the Alpha accumulates your paint mask & opacity. If you’re looking to pack R, G, B channel mask effects, just set this to the “M_PaintBrush_Regular_Additive” material provided in this plugin’s Content folder.

Most users will not need to create their own render brush, but you can do so if desired.

 UMaterialInterface*
Allow Duplicate Strokes Important for Decals, Gameplay effects, etc! By default the plugin allows you to keep accumulating or overwriting paint strokes on a single region.  Sometimes, however it is desirable to prevent players from being able to repeat a stroke on a location that has already been painted. Set this to false to achieve that. Eg: Painted Gameplay Items (like traps), Portal effects (eg: Exploding floors that leave holes behind them), Character Decal Tattoos that should only appear once, etc.  bool
Collision Inflation Scale Scales the paint collision associated with this stroke. Useful for Masked materials where your material’s “Opacity Mask Clip” affects perceived collision. As many collidable effects like Portals tend to use soft brushes or low opacity clip masks (to allow for crater WPO effects, etc to be visible…), the size of the observed hole/collision perceived by the player is potentially _smaller_ the actual brush size (collision size) at which you painted the portal!  float
Perform Network Replication Special option to support things like FoW systems where each _local_ player needs a different/unique perspective and therefore, a non-replicating paint FX.  bool