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:
| Property | Purpose |
|---|---|
WallMaterial | The base visual material for the wall mesh surface. |
wall_painter_material | A 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 paramsDrawParams.DrawMode = Color ← or TextureDrawParams.StartCenterWallPosition = (first hit result on wall)DrawParams.EndCenterWallPosition = (second hit result on wall)DrawParams.bFill = false ← true = fill entire wallDrawParams.MergeDistance = 0.0
// Color modeDrawParams.Color = FLinearColor(1, 0, 0, 1)
// OR Texture modeDrawParams.Texture = (your Texture2D asset)DrawParams.XScale = 1.0DrawParams.YScale = 1.0DrawParams.bNoYWrapping = false
// ExecuteWallActor (via IWallBpInterface) -> Draw To Wall (DrawParams)WallActor -> Commit Draw CallAlways 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:
| Function | Description |
|---|---|
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
| Field | Type | Default | Description |
|---|---|---|---|
DrawMode | EWallDrawMode | Color | Color Draw or Texture Draw |
StartCenterWallPosition | FHitResult | — | Start of the region to paint. Use Get Surface To Wall Center Position to convert a raw hit to the wall center. |
EndCenterWallPosition | FHitResult | — | End of the region to paint. |
bFill | bool | false | If true, fills the entire wall regardless of start/end. |
MergeDistance | float | 0.0 | Tolerance in cm to snap region edges to wall endpoints or nodes. |
Color | FLinearColor | White | Paint color. Used when DrawMode = Color. |
Texture | UTexture2D | none | Texture to tile. Used when DrawMode = Texture. |
XScale | float | 1.0 | Horizontal tiling scale. Used when DrawMode = Texture. |
YScale | float | 1.0 | Vertical tiling scale. Used when DrawMode = Texture. |
bNoYWrapping | bool | false | Prevents 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:
| Function | Description |
|---|---|
Get Surface To Wall Center Position (hitResult) → FVector | Returns the center position on the wall surface from a hit. Use this to fill StartCenterWallPosition and EndCenterWallPosition. |
Get Bottom Center Position From Vector (vec) → FVector | Returns 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(throughRestoreSurfaceData)
You can also save and restore manually:
WallActor -> Save Surface Data ← writes render target into SavedSurfaceDataWallActor -> Restore Surface Data ← re-applies SavedSurfaceData to the wall materialMemory 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.