PaintTest.mp4
Runtime material painting tool for Unreal Engine 5.4. Dynamically paint materials on Static and Skeletal Meshes with precise control over RGB and alpha channels. Fully integrated with Blueprint for rapid prototyping and gameplay mechanics.
- Paint directly on mesh surfaces during gameplay or in editor
- Support for both Static Meshes and Skeletal Meshes
- Real-time visual feedback
- No pre-baked textures required
- Independent RGB channel manipulation
- Alpha channel support for transparency and masking
- Additive and subtractive painting modes
- Configurable brush intensity and falloff
- Fully exposed to Blueprint for designer-friendly workflows
- Easy-to-use component system
- Event-driven architecture for paint interactions
- Customizable paint parameters at runtime
- Efficient render target updates
- Minimal CPU overhead
- GPU-accelerated painting operations
- Scalable for different hardware configurations
- Unreal Engine 5.4 or higher
- C++ project (or converted from Blueprint project)
- RenderCore and RHI modules access
- Basic understanding of materials and render targets
git clone https://github.com/vicvasper/PaintSystem.git- Open
PaintSystem.uprojectdirectly in Unreal Engine 5.4 - The project will compile automatically on first launch
- Explore the demo content to see paint system in action
- Copy the Source/PaintSystem folder contents to your project's Source folder
- Update your project's
.Build.csfile to include dependencies:PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "RenderCore", "RHI" });
- Regenerate project files
- Build your project in Visual Studio or Rider
Create a material with a Render Target parameter to receive paint data:
- Add a Texture Sample parameter named "PaintTexture"
- Set texture type to Render Target 2D
- Connect to Base Color (or desired material input)
Add the Paint System component to your actor:
- Add PaintComponent to your Blueprint actor
- Set target mesh component reference
- Configure paint settings (brush size, color, intensity)
- Call Paint function on input events
Assign your paint-enabled material to the mesh:
- Set material instance with PaintTexture parameter
- Ensure proper UV mapping for paint coordinates
// Component Setup
PaintComponent->SetTargetMesh(MeshComponent);
PaintComponent->SetBrushSize(10.0f);
PaintComponent->SetPaintColor(FLinearColor::Red);
// Paint on Mouse Click
OnMouseClicked()
{
PaintComponent->PaintAtLocation(HitLocation, HitNormal);
}
- Configure brush falloff curves
- Use texture-based brush stamps
- Implement custom blending modes
Paint different data to RGBA channels:
- R: Base color tint
- G: Roughness/smoothness
- B: Metallic values
- A: Emission/mask data
- Batch paint operations for multiple strokes
- Use lower resolution render targets when appropriate
- Implement LOD-based paint detail
Core Components
PaintComponent: Main component handling paint logicPaintData: Stores paint configuration and stateRenderTargetManager: Manages render target creation and updatesPaintShader: GPU shader for paint application
- Input detection (mouse/controller/VR)
- Surface hit detection via raycast
- UV coordinate calculation
- Render target update via GPU shader
- Material parameter update
- Visual feedback
- Dynamic creation based on mesh UV layout
- Automatic resolution calculation
- Memory pooling for efficiency
- Persistent or temporary modes
Paint operations executed on GPU for performance:
- Brush shape rendering
- Color blending
- Alpha compositing
- Multi-channel writing
- Brush Size: Radius in world units or UV space
- Brush Intensity: Paint opacity/strength (0-1)
- Brush Falloff: Edge softness curve
- Blend Mode: Add, Multiply, Replace, Erase
- Color: RGB values to paint
- Channels: Which RGBA channels to affect
Required material parameters for full functionality:
PaintTexture: Render Target 2DPaintIntensity: Scalar (optional)TintColor: Linear Color (optional)
- Use appropriate render target resolution (512x512 to 2048x2048)
- Batch paint strokes when possible
- Limit active paint components in scene
- Use texture compression for final baked results
- Consider lower update frequency for distant objects
Typical memory per painted mesh:
- 512x512 RT: ~1 MB
- 1024x1024 RT: ~4 MB
- 2048x2048 RT: ~16 MB
Calculate based on: Width x Height x 4 bytes (RGBA)
- Player graffiti/tagging systems
- Blood splatter and decals
- Environmental weathering
- Territory marking
- Paint-based puzzles
- Runtime texture painting
- Procedural detail addition
- Quick material variations
- Prototyping asset variations
- Virtual painting experiences
- 3D model customization
- Interactive art installations
- Verify mesh has valid UV coordinates
- Check material has PaintTexture parameter
- Ensure render target is assigned
- Confirm paint component is active
- Reduce render target resolution
- Limit number of simultaneously painted meshes
- Check for unnecessary paint updates
- Profile GPU usage with Unreal Insights
- Verify UV mapping is correct
- Check raycast hit detection
- Ensure proper world-to-UV coordinate conversion
- Test with simple UV debug material
- Requires valid UV0 channel on mesh
- Paint data not automatically serialized (requires custom save system)
- Maximum resolution limited by GPU memory
- Real-time painting may impact frame rate on lower-end hardware
- Save/load paint data to disk
- Multi-layer painting support
- Undo/redo functionality
- Networked multiplayer painting
- Mobile platform optimization
- Brush preset system
The project includes example content demonstrating:
- Basic paint setup on Static Mesh
- Skeletal Mesh painting
- Multi-channel painting
- Custom brush shapes
- VR painting implementation
Check the demo video in the repository for visual reference.
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Test thoroughly on UE 5.4
- Submit a pull request with detailed description
MIT License - See LICENSE file for details
Created by Victor Rivas (@vicvasper)
For questions, bug reports, or feature requests, please open an issue on GitHub.
- Repository: github.com/vicvasper/PaintSystem
- Portfolio: vicvasper.github.io/README
- LinkedIn: linkedin.com/in/victorrivasperez
Built with Unreal Engine 5.4. Special thanks to the Unreal Engine community for shader and rendering insights.