Builtin Library
README.md
SubsurfaceScattering
Marks an entity's meshes as carrying light beneath the surface. The terminator softens and warms instead of ending on a line, and light spreads through a thin edge instead of stopping at it.
entity(headId).component.add("SubsurfaceScattering", {
color = { 1.0, 0.3, 0.16 },
radius = 0.02,
})
Every field is live — editing one in the inspector moves the shading on the next frame, and the values persist with the scene. Removing the component stops the entity scattering, and the pass is released with the last marked entity.
| field | effect |
|---|---|
color | What light becomes beneath the surface. Its channels also set how far each one travels, so a tint weighted to red spreads red furthest. |
radius | How far light travels beneath the surface before leaving, in world units over [0, 1]. Skin at human scale sits near 0.02. |
strength | How much of the spread is mixed back into the frame, in [0, 1]. 0 leaves the shading exactly as it was lit. |
A radius below zero is reported as a warning and the last good setting stays live, so a typo in the inspector does not stop the component.
Code that marks meshes at runtime can drive the same settings through
@builtin::systems.subsurfaceScattering.subsurface.