Reference
Blueprint and C++ API
Every SkinMark Blueprint node and C++ function with its parameters: Apply Hit, spawn and remove, save and restore, rain and water.
Module SkinMark. Headers: SkinMarkComponent.h, SkinMarkLibrary.h, SkinMarkHitPreset.h, SkinMarkDemoDirector.h. Every function below is a Blueprint node unless it says C++ only. Sizes are in cm, times in seconds.
Features, one call each#
| Feature | Call or node | Notes |
|---|---|---|
| Matched set of marks for one hit | ApplyHit(Hit, Preset, Damage = 1, Direction = 0) |
Returns how many marks it spawned. Damage scales the sizes. |
| Same, with no setup | USkinMarkLibrary::ApplyHitToActor(Hit, Preset, Damage, Direction) |
Finds or adds the component. |
| One plain decal at a hit | SpawnDecalFromHit(Hit, Material, Size = 20, RotationDegrees = 0, Color) or SpawnSkinMarkAtHit(...) |
Returns the decal id, or -1. No material = DefaultMaterial (MI_SkinMark_BloodSplat). |
| One decal from a ray, no collision | SpawnDecalFromRay(Target, RayStart, RayDirection, Material, Size, RotationDegrees, Color) |
Returns the id, or -1. |
| Remove one / all | RemoveDecal(DecalId), ClearDecals(), ClearSkinMarks(Actor) |
Clear also resets wound sites and bloodiness. |
| Component on any actor | GetOrAddSkinMarkComponent(Actor) |
Game worlds only. |
| How bloody | GetBloodiness() |
0..1: summed soak levels over MaxBloodiness (12). |
| Build up over hits | automatic, per preset | Hits within a preset's SiteRadius share a wound site; crossing the next SoakLevels entry grows a bigger soak. |
| Rain | SetGlobalRain(Intensity) (static), SetLocalRain(Intensity) |
See Rain and water. |
| Water | SetWaterSurface(bEnabled, SurfaceZ); Water Volumes found on their own |
See Rain and water. |
| Respawn / save | GetSnapshot(), RestoreSnapshot(Snapshot, bRebuildNow = true) |
See Save and respawn. |
| Mesh swap | automatic (bKeepMarksOnMeshChange, on) |
Same skeleton: marks are rebuilt on the new mesh. |
| Multiplayer | tick bReplicateMarks, call ApplyHit on the server |
See Multiplayer. |
| Modular characters | automatic (bContinueAcrossParts, on) |
See Modular characters. |
| Morph targets | automatic | See Morph targets and cloth. |
| Warm-up | PreloadPresets(Presets), PrewarmTarget(Target) |
Prewarm runs for every mesh of the owner at Begin Play by default. |
USkinMarkComponent#
Add it with Add > Skin Mark in the character Blueprint. One per character covers every skinned mesh of its actor.
ApplyHit#
Turns one hit into the preset's matched set of marks, sized by Damage. Hits within the preset's SiteRadius of an earlier hit add to that wound site and grow its soak. A hit on the owner's capsule (or another collision shape) follows its ray to the owner's skeletal meshes; a hit on a mesh part without skin (shield, armour, weapon) makes no marks. Returns how many marks it spawned. Call it on the server in multiplayer.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| Hit | FHitResult |
The hit from a trace, sweep or projectile. | |
| Preset | USkinMarkHitPreset* |
The hit preset, for example DA_Hit_Bullet. |
|
| Damage | float |
1 | Scales the sizes (each layer's DamageSizeScale decides how much). |
| Direction | FVector |
zero | Advanced pin. Swing direction for slashes (AlongDirection and AcrossDirection layers). Zero = the hit ray. |
SpawnDecalFromHit#
One plain decal where the hit landed. Needs a hit on the skinned mesh itself. Returns the decal id (for RemoveDecal), or -1 when the hit is not on a skinned mesh.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| Hit | FHitResult |
The hit. | |
| Material | UMaterialInterface* |
none | Deferred Decal material. None = DefaultMaterial. |
| Size | float |
20 | cm. |
| RotationDegrees | float |
0 | Roll, added on top of bAlignToGravity. |
| Color | FLinearColor |
white | Tint. |
SpawnDecalFromRay#
One decal where a world ray meets the skin of Target. Needs no collision. Returns the id, or -1.
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| Target | USkinnedMeshComponent* |
The mesh to mark. | |
| RayStart | FVector |
World start of the ray. | |
| RayDirection | FVector |
World direction of the ray. | |
| Material | UMaterialInterface* |
none | None = DefaultMaterial. |
| Size | float |
20 | cm. |
| RotationDegrees | float |
0 | Roll. |
| Color | FLinearColor |
white | Tint. |
Removing marks#
| Function | Returns | What it does |
|---|---|---|
RemoveDecal(int32 DecalId) |
bool |
Removes one decal by the id a spawn call returned. False when it is already gone. |
ClearDecals() |
Removes every decal and wound site (bloodiness back to 0), for example on respawn. |
Warm-up#
| Function | What it does |
|---|---|
PreloadPresets(const TArray<USkinMarkHitPreset*>& Presets) |
Loads these presets' materials (layers and soak) now and keeps them loaded while the component lives, so their first hit does not load assets mid-frame. |
PrewarmTarget(USkinnedMeshComponent* Target) |
Builds the per-mesh spawn data now. Done for every mesh of the owner at Begin Play by default (bPrewarmOnBeginPlay). |
Reading state#
| Function or property | Returns | What it gives |
|---|---|---|
GetNumDecals() |
int32 |
Decals on this character, including ones still being built (they appear within a few frames). 0 on a dedicated server (the marks exist on clients). |
GetBloodiness() |
float |
0..1: summed soak levels over MaxBloodiness (12). |
GetNumWoundSites() |
int32 |
Spots that took hits (hits within a preset's SiteRadius share one spot). |
LastHitSiteLevel |
int32 |
Soak level of the wound site the last ApplyHit added to (0 = no soak yet). Read only. |
LastHitSiteAmount |
float |
Summed damage of the wound site the last ApplyHit added to. Read only. |
Save and restore#
| Function | Returns | What it does |
|---|---|---|
GetSnapshot() |
FSkinMarkSnapshot |
Every mark as a compact record. Decals still being built are finished first. |
RestoreSnapshot(const FSkinMarkSnapshot& Snapshot, bool bRebuildNow = true) |
int32 |
Replaces every mark with the snapshot's, in the original order (same look, same draw order). Bones by name: works on the same mesh, another LOD or Nanite version, or another mesh with the same skeleton. A mark whose bone or skin is missing is skipped with a warning. bRebuildNow false = build over the next frames under SkinMark.SpawnBudgetMs. Returns the marks restored. |
How to use them: Save, respawn and mesh swap.
Rain and water#
| Function | Returns | What it does |
|---|---|---|
SetGlobalRain(float Intensity) |
Static. Rain 0..1 for every component that uses global rain. Same as console SkinMark.Rain. |
|
GetGlobalRain() |
float |
Static. The global rain. |
SetLocalRain(float Intensity) |
This character's own rain 0..1 (turns global rain off for it). 0 = under a roof. | |
SetWaterSurface(bool bEnabled, float SurfaceZ) |
Water-height wash on at world Z, or off. Call it when the water height changes. | |
GetEffectiveRain() |
float |
The rain this character uses now. |
GetWaterSurface(float& OutSurfaceZ) |
bool |
True when a water surface applies; gives its Z. |
How they look: Rain and water.
Debug (read only)#
GetNumPendingDecals, NumRestored, NumCrossPart, LastSpawnWorkMs, LastTickMs, LastTickVerts, MaxSpawnLatencyFrames, NumFullRebuilds, NumAppends, NumNewSections, NumHitMissed, NumUploadsDeferred, LastWashMs, LastWashUploadMs, LastWashSkinnedVerts, NumWashedAway: cost and counters for profiling. C++ only test helpers: MeasureMaxSkinningError, DescribeSections, GetDecalIds.
All component properties: Settings.
USkinMarkLibrary#
Static Blueprint nodes in category Skin Mark. They find or add the component, so you can call them from a weapon or projectile without touching the character Blueprint. Adding the component in the Blueprint is still better, because presets preload.
| Function | Returns | What it does |
|---|---|---|
ApplyHitToActor(const FHitResult& Hit, USkinMarkHitPreset* Preset, float Damage = 1, FVector Direction = zero) |
int32 |
ApplyHit without setup: finds or adds the component on the hit actor. Returns marks spawned (0 when no skin is found). |
SpawnSkinMarkAtHit(const FHitResult& Hit, UMaterialInterface* Material, float Size = 20, float RotationDegrees = 0, FLinearColor Color = white) |
int32 |
One decal at the hit, component found or added. Needs a hit on the skinned mesh itself. Returns the id, or -1. |
GetOrAddSkinMarkComponent(AActor* Actor) |
USkinMarkComponent* |
The actor's component, added if missing. Game worlds only. |
ClearSkinMarks(AActor* Actor) |
Removes every mark and wound site from the actor. Does nothing when it has no component. |
USkinMarkHitPreset#
A data asset: a matched set of marks for one kind of hit. Properties: Settings.
| Function | What it does |
|---|---|
SetLayerMaterialPath(int32 LayerIndex, const FString& Path) |
Sets a layer's material by path without loading it (for scripts). |
SetSoakMaterialPath(const FString& Path) |
Sets the soak material by path without loading it. |
ESkinMarkOrient, the layer's Orient value:
| Value | Meaning |
|---|---|
| Random | Random roll around the surface normal. |
| Gravity | Bottom of the image points down the body: drips and streams run downward. |
| AlongDirection | The image follows the hit direction (the swing direction, or the ray) on the skin. |
| AcrossDirection | Like AlongDirection, turned 90 degrees. |
FSkinMarkSnapshot#
A SaveGame struct, Blueprint readable, saved in a compact binary form (about 0.21 KB per mark). Put it in your SaveGame object.
| Field | Meaning |
|---|---|
Decals |
One FSkinMarkDecalRecord per mark: Id, SeedId, Part, Bone, LocalCenter / LocalX / LocalZ in bone space, Size, Depth, Material (soft path), Color, Age, Wash, Wet, bSoak, CompanionOf, Pose (other bones the mark's skin follows, stored relative to Bone) and Morphs (the morph weights active when the mark was made). |
Sites |
Wound sites. |
MaterialOrder |
Materials in first-use order. |
NextId, DeferredMisses, RandomState, bRandomStarted |
Ids and random state, so ApplyHit continues with the same random stream after a restore. |
ASkinMarkDemoDirector#
| Function | What it does |
|---|---|
StartDemo() |
Restarts and looks for characters again. |
StopDemo() |
Stops. The marks stay. |
GetNumHitsApplied() |
Hits applied so far. |
Settings and the log line: Demo actor and map.
Blueprint recipes#
These are the node chains from the quick start.
Gun: Line Trace For Objects (Pawn, PhysicsBody, WorldStatic, WorldDynamic; shooter ignored) from the muzzle
> Out Hit > Get Component by Class (Skin Mark) on Hit Actor
> Apply Hit (Hit, DA_Hit_Bullet, Damage 1)
Projectile: OnComponentHit / Event Hit > pass its Hit to Apply Hit (a hit on the capsule is fine)
Melee: weapon's notify state tick > Sphere Trace For Objects (Pawn and PhysicsBody, attacker ignored,
from the last tip position to the current one) > Apply Hit (Hit, DA_Hit_Slash),
Direction (advanced pin) = the swing directionC++ declarations#
From SkinMarkComponent.h and SkinMarkLibrary.h:
// USkinMarkComponent
int32 ApplyHit(const FHitResult& Hit, USkinMarkHitPreset* Preset, float Damage = 1.f, FVector Direction = FVector::ZeroVector);
int32 SpawnDecalFromHit(const FHitResult& Hit, UMaterialInterface* Material = nullptr, float Size = 20.f, float RotationDegrees = 0.f, FLinearColor Color = FLinearColor::White);
int32 SpawnDecalFromRay(USkinnedMeshComponent* Target, FVector RayStart, FVector RayDirection, UMaterialInterface* Material = nullptr, float Size = 20.f, float RotationDegrees = 0.f, FLinearColor Color = FLinearColor::White);
bool RemoveDecal(int32 DecalId);
void ClearDecals();
FSkinMarkSnapshot GetSnapshot();
int32 RestoreSnapshot(const FSkinMarkSnapshot& Snapshot, bool bRebuildNow = true);
void PrewarmTarget(USkinnedMeshComponent* Target);
void PreloadPresets(const TArray<USkinMarkHitPreset*>& Presets);
static void SetGlobalRain(float Intensity);
static float GetGlobalRain();
void SetLocalRain(float Intensity);
void SetWaterSurface(bool bEnabled, float SurfaceZ);
float GetEffectiveRain() const;
bool GetWaterSurface(float& OutSurfaceZ) const;
float GetBloodiness() const;
int32 GetNumWoundSites() const;
int32 GetNumDecals() const;
// USkinMarkLibrary
static USkinMarkComponent* GetOrAddSkinMarkComponent(AActor* Actor);
static int32 ApplyHitToActor(const FHitResult& Hit, USkinMarkHitPreset* Preset, float Damage = 1.f, FVector Direction = FVector::ZeroVector);
static int32 SpawnSkinMarkAtHit(const FHitResult& Hit, UMaterialInterface* Material, float Size = 20.f, float RotationDegrees = 0.f, FLinearColor Color = FLinearColor::White);
static void ClearSkinMarks(AActor* Actor);