Skip to main content

📖 API Reference

Comprehensive reference for Simple Painter's public API surface — interfaces, enums, data structures, blend modes, and environment configuration.


🔌 Core Interfaces

InterfaceDescription
ICommandBase interface for all GPU paint commands dispatched to the PaintEngine
IPaintNodeNode in the paint hierarchy — handles activation, deactivation, and lifecycle
IPaintBehaviourExtends IPaintNode with Unity MonoBehaviour integration
IPaintContainerContainer that manages child IPaintNode instances and propagates state
IPaintCommitterCommits processed stamp data to target textures (direct or simulation)
IStrokeSamplerSamples and interpolates input into StampData using a stroke method
IToolPolls StampBatch from surfaces and dispatches GPU draw commands
IShaderBinder<T>Generic interface for binding typed data to shader properties

🏷️ Key Enums

EnumValues
StampShapeModeCircle, Square, Custom
StrokePhaseBegin, Update, End
TextureMappingModeStretch, Tile, FitWidth, FitHeight
DynamicModeConstant, Distance, Speed, Time, Random
ValueModeStatic, Dynamic
TargetTextureTypeAlbedo, Normal, Metallic, Roughness, Height, Emission
TextureBitDepthUNorm8, UNorm16, SFloat16, SFloat32
NormalInputModeObjectSpace, TangentSpace
RenderPipelineTypeBuiltIn, URP, HDRP

📐 StampData Struct

The StampData struct is the core data unit passed through the painting pipeline — from stroke sampler to tool to committer.

FieldTypeDescription
InverseMatrixMatrix4x4Inverse transform matrix for UV-space stamp placement
WorldPositionVector3World-space position of the stamp
VelocityVector2Stroke velocity in UV-space (used by fluid force brushes)
OpacityfloatFinal opacity after dynamics evaluation (01)
BrushDynamicsfloatDynamics intensity value (01)
ShapeStampShapeModeShape mask applied to this stamp
PhaseStrokePhaseCurrent phase: Begin, Update, or End

🎨 Blend Modes

Color Blend Modes

Used for Albedo, Emission, and other color-based channels:

ModeDescription
NormalStandard alpha-composite blending
MultiplyDarkens by multiplying base and blend colors
AddBrightens by adding blend color to base
MinTakes the minimum of base and blend per channel
MaxTakes the maximum of base and blend per channel
ScreenInverse multiply — lightens the base color
OverlayCombines Multiply and Screen based on base luminance
SoftLightSubtle tonal adjustment similar to Overlay but softer

Scalar Blend Modes

Used for Metallic, Roughness, and Height channels:

ModeDescription
NormalDirect replacement weighted by opacity
MultiplyMultiplies base and blend values
AddAdds blend value to base
MinTakes the minimum value
MaxTakes the maximum value

Normal Blend Modes

Used for Normal map channels:

ModeDescription
LerpLinear interpolation between base and detail normal
RNMReoriented Normal Mapping — most physically accurate
UDNUnreal Developer Network method — fast approximation
WhiteoutWhiteout blending — strong detail preservation
OverlayOverlay-style normal blending
MaxSlopeTakes the steeper slope per texel
SubtractSubtracts detail normal from base
warning

Simulation committers (FluidShallow, FluidViscous, FluidParticle) always force NormalBlendMode.MaxSlope regardless of the channel's configured blend mode. This ensures fluid flow correctly accumulates surface displacement.


🌍 PaintEnvironment

The PaintEnvironment component provides environmental forces that affect fluid simulation behavior through a FlowField texture.

FlowField Texture Records

The FlowField texture encodes four data channels:

RecordChannelDescription
Seam LinkingRUV seam connectivity data for cross-seam fluid flow
Border PaddingGDistance-to-border field for edge handling
Anti-Gravity FlowBOverrides gravity direction for upward/sideways flow
External ForcesAAdditional force field from external sources

Environment Features

FeatureDescription
GravityDirectional gravity force affecting all fluid simulation
WindDirectional wind force applied to fluid surfaces
PerturbationProcedural noise-based disturbance for organic motion
External ForcesUser-defined force textures injected into the simulation

Bake Update Modes

ModeDescription
OnceBakes the FlowField once on initialization — use for static environments
AlwaysRe-bakes the FlowField every frame — use for dynamic environments with moving objects
tip

Use Once mode for static scenes to save GPU bandwidth. Switch to Always only when environment geometry changes at runtime (e.g., destructible walls).


Previous: Committers & Fluid Simulation | Next: Best Practices