Skip to content

Materials and Wall Paint — Wall Plugin

Materials and Wall Paint

The CodPassionWall plugin supports painting wall surfaces with solid colors or tiled textures. Painting works at runtime from Blueprint/C++ and from the editor panel’s Paint Wall mode.


Required materials

Every AWallLineActor uses two materials:

PropertyPurpose
WallMaterialThe base visual material for the wall mesh surface.
wall_painter_materialA special material that supports runtime painting via a render target. Required for painting to work.

Assign both in the Details panel under WallPlugin | Wall | Components, or pass them when spawning.


Painting from the editor panel

In the CodPassionWall editor panel, click Paint Wall to enter paint mode. See Build Mode – Paint Wall for the full workflow and all panel controls.


Painting from Blueprint or C++

Wall actors implement IWallBpInterface. All paint functions are available through this interface.

Using the unified DrawToWall function

The recommended approach is to fill an FWallDrawParams struct and call Draw To Wall:

// Set up params
DrawParams.DrawMode = Color ← or Texture
DrawParams.StartCenterWallPosition = (first hit result on wall)
DrawParams.EndCenterWallPosition = (second hit result on wall)
DrawParams.bFill = false ← true = fill entire wall
DrawParams.MergeDistance = 0.0
// Color mode
DrawParams.Color = FLinearColor(1, 0, 0, 1)
// OR Texture mode
DrawParams.Texture = (your Texture2D asset)
DrawParams.XScale = 1.0
DrawParams.YScale = 1.0
DrawParams.bNoYWrapping = false
// Execute
WallActor (via IWallBpInterface) -> Draw To Wall (DrawParams)
WallActor -> Commit Draw Call

Always call Commit Draw Call after Draw To Wall to finalize the operation. To cancel without applying, call Abbort Draw Call instead.


Convenience functions

For simpler cases, individual draw functions are also available:

FunctionDescription
Draw Color To Wall (color, startHit, endHit, fill)Paints a region with a solid color.
Draw Color To Wall And Merge (color, startHit, endHit, fill, mergeDistance)Same, with merge snapping.
Draw Texture To Wall (texture, startHit, endHit, xScale, yScale, fill, noYWrapping)Tiles a texture across a region.
Draw Texture To Wall And Merge (...)Same, with merge snapping.

All these functions still require a Commit Draw Call to take effect.


FWallDrawParams struct fields

FieldTypeDefaultDescription
DrawModeEWallDrawModeColorColor Draw or Texture Draw
StartCenterWallPositionFHitResultStart of the region to paint. Use Get Surface To Wall Center Position to convert a raw hit to the wall center.
EndCenterWallPositionFHitResultEnd of the region to paint.
bFillboolfalseIf true, fills the entire wall regardless of start/end.
MergeDistancefloat0.0Tolerance in cm to snap region edges to wall endpoints or nodes.
ColorFLinearColorWhitePaint color. Used when DrawMode = Color.
TextureUTexture2DnoneTexture to tile. Used when DrawMode = Texture.
XScalefloat1.0Horizontal tiling scale. Used when DrawMode = Texture.
YScalefloat1.0Vertical tiling scale. Used when DrawMode = Texture.
bNoYWrappingboolfalsePrevents vertical tiling. Used when DrawMode = Texture.

Getting the correct wall position from a hit result

When you hit a wall with a line trace, use these helpers to convert the raw surface hit into the correct wall-center position for painting:

FunctionDescription
Get Surface To Wall Center Position (hitResult) → FVectorReturns the center position on the wall surface from a hit. Use this to fill StartCenterWallPosition and EndCenterWallPosition.
Get Bottom Center Position From Vector (vec) → FVectorReturns the bottom-center equivalent of a world position relative to the wall.

Saving and restoring paint data

Paint data (the render-target pixel data for each wall side) is stored in the SavedSurfaceData property on the wall actor. This data is:

  • Saved automatically as part of UWallGameSubsystem::SaveWalls
  • Restored via UWallGameSubsystem::LoadWalls (through RestoreSurfaceData)

You can also save and restore manually:

WallActor -> Save Surface Data ← writes render target into SavedSurfaceData
WallActor -> Restore Surface Data ← re-applies SavedSurfaceData to the wall material

Memory considerations

Paint data is stored as raw BGRA8 pixel data per wall side. For long or tall walls, this data can become substantial. Keep this in mind if you have many painted walls in a save slot.