Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit44fd9e59bd

README.md

DecalProjector

Turns its entity into an oriented box decal projector — the deferred-decal equivalent of Unreal's Decal Actor or Unity's Decal Projector. The entity's Transform is the projection volume: position and rotation orient the box, scale sizes it, and the projector stamps its material along the box's local −Z onto every surface inside the box, reconstructing each covered pixel's world position from scene depth and fading on faces turned away from the projection axis so the decal wraps the surfaces facing it.

Surface

FieldTypeMeaning
materialAssetRef<material>What the projector stamps. Its base-colour texture + tint drive the decal — a textured material projects its texture, a flat-colour material projects its colour. Defaults to @builtin::materials.decal_default.
opacitynumberMaster fade, 0..1.

Registers into the @builtin::modules.decals registry on awake/onEnable (and re-registers on property change / in edit mode), which the @builtin::renderFeatures.decals render feature reads every frame.

Example

-- A downward projector that stamps a texture onto whatever is under it.
local p = entity.spawn("floorDecal")
p.localPosition = { 0, 3, 0 }
p.localScale = { 6, 6, 4 }
p.localRotation = { 0.70710678, 0, 0, 0.70710678 } -- project down (-Y)
p.component.add("DecalProjector", {
    material = "@builtin::materials.decal_default",
    opacity = 1.0,
})