Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

SURFACESDIRT

Dirt

Drive a vehicle through mud and its lower body and wheel arches take the mud. Drive on asphalt and they stay clean. The wheels do the work: each wheel gives the body what the ground under it holds, and the body keeps that dirt until it fades or you wash it off. This page covers the four kinds of dirt, how they lie on the body, and the settings that shape them.

The plugin's sedan seen from the front left and slightly below, with brown dirt on the bumper, wheel arch, doors, rear quarter and wheels.
Dirt on the body and the wheels of the plugin's sedan.

Each wheel on a surface throws dirt onto its body. The plugin keeps four kinds for each body: dust, mud, snow and wetness. Every kind lands in its own shape: dust sprays up the body, mud splashes into the arches and behind the wheels, and snow lies low in the same places. The body’s paint and the wheels draw the dirt, so the look changes as the body gets covered.

The sedan throws mud as it drives onto the MUD lane.
  • Channels. The dirt atlas keeps one value per kind for each texel: dust in red, mud in green, snow in blue and wetness in alpha. ECFDirtChannel names the four channels.
  • Rates. The row of a surface gives each wheel on it four gain rates (Dust, Mud, Snow, Wet), per second at the reference speed. A wheel gives dirt in proportion to its surface speed over Dirt Reference Speed, up to Max Dirt Speed Scale times the rates. A wheel that stands still on a surface gives none, and a wheel in the air gives none.
  • Shapes. A channel reaches the body through a shape with three parts: a spray that rises from the ground, an arch round each axle and a tail streaked behind each wheel. A part with weight 0 is switched off. The profile holds one shape per kind (DustShape, MudShape, SnowShape and WetShape). Dirt Scale multiplies every deposit, and 0 keeps the body clean with no dirt grid at all.
  • Shedding. The Shed rates of a surface take dirt off the whole body, averaged over its wheels.
  • Stacking. A channel is either a Layer, which joins the stack, or an Overlay, which is drawn above every layer. The stack follows each channel’s ZOrder, lowest drawn first. Under Most Recent on Top the layer that gained dirt last lies on top instead. That order reads the fresh atlas (Dirt Fresh Atlas), which records when each texel last gained dirt. The shipped channels are these:
ChannelBlendZOrderFade Delay (s)Fade Duration (s)
DustLayer010120
MudLayer110120
SnowLayer21090
WetOverlay3225
  • Baked order. MF_CF_Paint and MF_CF_DirtAmount carry the layer order as constants: Dirt Layer Order, and each channel’s Blend and ZOrder. Change one of them in the editor and both functions are rebuilt at once. The rebuild leaves them unsaved, so save both to keep the order. Fade Delay, Fade Duration and the channel name are read while the game runs and need nothing.
  • Clearing. A channel waits Fade Delay seconds after its last fresh dirt, then clears over Fade Duration seconds. A duration of 0 keeps it.
  • Look. MF_CF_Paint draws the dirt on the body and MF_CF_WheelDirt on the wheels. Both read MPC_CF_Dirt, the collection that holds the look every vehicle shares. A project can draw its own look instead, in Project Settings under the Look section.
  • Dedicated server. A dedicated server draws nothing, so it keeps no dirt on the body and fires none of the dirt events.
  1. In the Content Browser, choose Add > Miscellaneous > Data Asset, pick the class CFProfile and name the asset DA_MyVehicle_Profile. This is the body’s deform profile, and the dirt shapes live in it.
  2. Open the profile. Under Dirt, set Dirt Scale to 1. The four shapes start with the defaults: dust sprays, mud and snow are thrown into the arches and tails, and wetness sprays with a light arch.
  3. On the vehicle’s adapter component, tick Dirt and Dents and set Deform Profile to the profile. With Deform Profile empty, the project’s default profile is used.
  4. Check the surfaces table. In Project Settings > Plugins > Crushform, Surfaces points to DA_CF_Surfaces by default. Each row there says how much dirt its ground gives (see Wheels and surfaces).
  5. Drive over a dirt strip and check the result as described in Check that it works below.

To clean a spot on the body where the player hits it, call Wash At on the deform component with the hit point and a radius in centimetres. The graph below runs when the custom event WashNearMe fires, and washes a circle of 150 cm round the actor.

The graph runs when the custom event WashNearMe fires and washes a circle of 150 cm round the actor.

From C++, get the deform component from the adapter and call WashAt. GetDirtAt reads the dirt at a point, per channel. The calls need the Crushform module (CFDeformComponent.h) and the CrushformVehicle module (CFVehicleAdapterComponent.h); add both to PublicDependencyModuleNames in your module’s Build.cs.

UCFDeformComponent* Deform = Adapter->GetDeform();
Deform->WashAt(HitLocation, 150.f);
const FCFDirtValues Here = Deform->GetDirtAt(HitLocation);

WashAt works on this machine only, so call it on every machine that should see the result. Wash washes the whole body and is authority only: it runs on the server and reaches every machine.

PropertyWhat it doesDefault
UCFProfile::DirtScaleMultiplies every dirt deposit on the body. 0 keeps it clean and gives it no dirt grid.1
UCFProfile::DustShapeThe spray, arch and tail of the dust channel. The other kinds have their own: MudShape, SnowShape, WetShape.Dust sprays; mud has an arch and a tail; snow has all three; wetness sprays with a light arch
UCFSettings::DirtReferenceSpeedTyre speed at which a surface’s rates apply as written, m/s.8
UCFSettings::MaxDirtSpeedScaleMost a faster tyre multiplies the rates by.2
UCFSettings::DirtUpdateIntervalSeconds between two dirt updates of one body.0.2
UCFSettings::DirtLayerOrderLayers stack by each channel’s ZOrder, or the most recent dirt lies on top. Baked into the dirt functions.Fixed
FCFDirtChannelSettings::FadeDelaySeconds without fresh dirt before a channel starts to clear.10 (Wet 2)
FCFDirtChannelSettings::FadeDurationSeconds that full dirt takes to clear. 0 keeps it.120 (Snow 90, Wet 25)
UCFSettings::DirtEventIntervalShortest pause, in seconds, between two dirt-changed events of one body.0.5
UCFSettings::DirtEventThresholdHow far the mean dirt of a side must move, 0 to 1, before the next event fires.0.02
UCFSettings::DirtAtlasThe render target that holds the dirt, one channel per kind./Crushform/Atlas/RT_CF_DirtAtlas
UCFSettings::DirtLookThe collection of the look every vehicle shares: DirtStrength, WetDarken, WetGloss and the colours./Crushform/Materials/MPC_CF_Dirt
UCFSettings::SurfacesThe surfaces table. Without it no body gets dirty./Crushform/Surfaces/DA_CF_Surfaces

DirtStrength is at least 0, and 0 means no dirt anywhere. WetDarken is the factor that whatever lies under the wet is multiplied by, from 0 to 1, where 1 means no darkening. WetGloss is the share of the paint’s roughness that wet paint loses, from 0 to 1.

Drive the sedan from the ASPHALT strip onto the DIRT strip on the Proving Ground and stop on it. The lower sides and the wheel arches take dirt as the wheels roll over it. Drive back onto the asphalt and stop. The dust and mud start to clear 10 seconds after their last fresh dirt, and take up to 120 seconds more to clear, unless you washed the body first.

Cause. Three things keep a body clean. Without a surfaces asset in Surfaces, no body gets dirty. A profile with Dirt Scale at 0 has no dirt grid. A dedicated server draws no dirt.

Fix. Set Surfaces to a surfaces asset with rows for your grounds. Set Dirt Scale above 0 on the profile. Test on a listen server or a client, not on a dedicated server.

Cause. A wheel’s deposit grows with its surface speed, so a wheel that is locked and still deposits nothing. A row whose dirt rates are all 0 gives nothing either. A wheel on a physical material with no row gets the Default row, and a wheel in the air gets none.

Fix. Roll the wheel. Set the dirt rates on the row of that ground’s physical material, or on Default for the grounds that have no row.

Cause. A channel whose Fade Duration is 0 keeps its dirt until it is washed off.

Fix. Set Fade Duration above 0 for that channel, under Dirt > Channels in the project settings, or wash the body.

Cause. The order is baked into MF_CF_Paint and MF_CF_DirtAmount, so a change of Dirt Layer Order, Blend or ZOrder shows only after both functions are rebuilt. Nothing is rebuilt while either function is open in the Material Editor, and the notification says so.

Fix. Close MF_CF_Paint and MF_CF_DirtAmount, run Crushform.RebakeDirtOrder in the editor console, and save both functions. The command is editor only.

Cause. The order reads the dirt fresh atlas. Without a usable Dirt Fresh Atlas it falls back to Z Order and logs once per world:

No usable Crushform dirt fresh atlas (Project Settings > Plugins > Crushform > Dirt Fresh Atlas): %s keeps the freshness of its dirt but cannot show it, so on the body Most Recent On Top falls back to Z Order (the wheels keep ranking by freshness)

Fix. Set Dirt Fresh Atlas to /Crushform/Atlas/RT_CF_DirtFreshAtlas. A replacement must be an RGBA8 render target of the same size as the lattice atlas, or the log names it and the fallback stays.