Decal
Entity that projects a texture onto a MeshInstance3D.
Entity that projects a texture onto a MeshInstance3D.
Decals are used to project a texture onto a Mesh in the scene. Use Decals to add detail to a scene without affecting the underlying Mesh. They are often used to add weathering to building, add dirt or mud to the ground, or add variety to props. Decals can be moved at any time, making them suitable for things like blob shadows or laser sight dots.
They are made of an Aabb and a group of Texture2Ds specifying Color, normal, ORM (ambient occlusion, roughness, metallic), and emission. Decals are projected within their Aabb so altering the orientation of the Decal affects the direction in which they are projected. By default, Decals are projected down (i.e. from positive Y to negative Y).
The Texture2Ds associated with the Decal are automatically stored in a texture atlas which is used for drawing the decals so all decals can be drawn at once. Reckfell uses clustered decals, meaning they are stored in cluster data and drawn when the mesh is drawn, they are not drawn as a post-processing effect after.
Note: Decals cannot affect an underlying material's transparency, regardless of its transparency mode (alpha blend, alpha scissor, alpha hash, opaque pre-pass). This means translucent or transparent areas of a material will remain translucent or transparent even if an opaque decal is applied on them.
Note: Decals are only supported in the Forward+ and Mobile rendering methods, not Compatibility. When using the Mobile rendering method, only 8 decals can be displayed on each mesh resource. Attempting to display more than 8 decals on a single mesh resource will result in decals flickering in and out as the camera moves.
Note: When using the Mobile rendering method, decals will only correctly affect meshes whose visibility AABB intersects with the decal's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, GeometryInstance3D.ExtraCullMargin must be increased on the mesh. Otherwise, the decal may not be visible on the mesh.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
DecalConstructor
public Decal();Properties15
AlbedoMixProperty
public float AlbedoMix { get; set; }Base-color modification weight. Zero retains the original surface albedo but does not disable Normal/ORM when TextureAlbedo provides an alpha mask. Use Visible=false to disable the entire instance.
CullMaskProperty
public uint CullMask { get; set; }Receiver rendering-layer bitmask. The decal applies when it overlaps the mesh VisualInstance3D.Layers. This is not PhysicsBody3D.CollisionLayer or a single layer number. The example CullMask=2 selects floor meshes with Layers=2.
DistanceFadeBeginProperty
public float DistanceFadeBegin { get; set; }Camera-to-decal-position distance after which fading begins when DistanceFadeEnabled=true. Contribution is retained before it. Use a nonnegative distance for a predictable setup.
DistanceFadeEnabledProperty
public bool DistanceFadeEnabled { get; set; }Enables fading by distance between the camera and decal position. Uses DistanceFadeBegin and DistanceFadeLength. This is visual decal optimization, not script suspension or Entity removal.
DistanceFadeLengthProperty
public float DistanceFadeLength { get; set; }Transition length after DistanceFadeBegin. With distance fade enabled, the decal is excluded beyond Begin+Length. Use a positive value: zero length does not define a smooth transition.
EmissionEnergyProperty
public float EmissionEnergy { get; set; }TextureEmission multiplier. Zero removes that contribution, not albedo/Normal/ORM. Decal emission does not create a Light3D or guarantee lighting of neighboring meshes.
LowerFadeProperty
public float LowerFade { get; set; }Nonnegative falloff exponent toward the projection volume’s negative local-Y boundary. Zero removes this gradient; negative assignments become zero. Reducing Size.Y changes the intersection region rather than this exponent.
ModulateProperty
public Color Modulate { get; set; }RGB multiplies albedo and emission colors. Alpha attenuates albedo and its mask-driven Normal/ORM blending; emission is not multiplied by Modulate.A. Alpha=0 therefore does not reliably disable the whole decal.
NormalFadeProperty
public float NormalFade { get; set; }Attenuates projection on surfaces whose geometric normals face an unsuitable direction. A positive value enables angular falloff; this is not TextureNormal strength. The example uses 0.5; angular edge cases are not separately verified.
SizeProperty
public Vector3 Size { get; set; }Full projection-volume dimensions along local axes. X/Z define texture coverage and Y defines depth. The volume must intersect the surface. Assignment clamps every component to at least 0.001; these are not half-extents.
TextureAlbedoProperty
public Texture2D TextureAlbedo { get; set; }Decal color and alpha mask. Alpha also controls Normal and ORM blending; to change only those channels, retain the Albedo texture and set AlbedoMix=0. Removing this texture is not equivalent to zero AlbedoMix.
TextureEmissionProperty
public Texture2D TextureEmission { get; set; }Additive emission from texture RGB, independent of TextureAlbedo and its alpha mask. Non-emitting areas must be black in RGB; transparency alone does not guarantee zero emission. Brightness is multiplied by EmissionEnergy and Modulate.RGB.
TextureNormalProperty
public Texture2D TextureNormal { get; set; }Normal map modifies surface lighting within the TextureAlbedo alpha mask rather than geometry or collision. For a normal-only decal, assign both textures and AlbedoMix=0. The example does not validate imported-map orientation or authoring-tool conventions.
TextureOrmProperty
public Texture2D TextureOrm { get; set; }Packed channels: R ambient occlusion, G roughness, B metallic. Blending uses TextureAlbedo alpha. The example verifies a material change with AlbedoMix=0 and removal of that influence when the Albedo texture is absent.
UpperFadeProperty
public float UpperFade { get; set; }Nonnegative falloff exponent toward the projection volume’s positive local-Y boundary. Zero removes this gradient; negative assignments become zero. This is separate from camera-distance fade.
Methods24
GetAlbedoMixfloat
public float GetAlbedoMix();Reads AlbedoMix from this instance. The value alone does not establish visible projection onto a surface.
floatBase-color modification weight. Zero retains the original surface albedo but does not disable Normal/ORM when TextureAlbedo provides an alpha mask. Use Visible=false to disable the entire instance.
GetCullMaskuint
public uint GetCullMask();Reads CullMask from this instance. The value alone does not establish visible projection onto a surface.
uintReceiver rendering-layer bitmask. The decal applies when it overlaps the mesh VisualInstance3D.Layers. This is not PhysicsBody3D.CollisionLayer or a single layer number. The example CullMask=2 selects floor meshes with Layers=2.
GetDistanceFadeBeginfloat
public float GetDistanceFadeBegin();floatGetDistanceFadeLengthfloat
public float GetDistanceFadeLength();floatGetEmissionEnergyfloat
public float GetEmissionEnergy();floatGetLowerFadefloat
public float GetLowerFade();floatGetModulateColor
public Color GetModulate();Reads Modulate from this instance. The value alone does not establish visible projection onto a surface.
ColorRGB multiplies albedo and emission colors. Alpha attenuates albedo and its mask-driven Normal/ORM blending; emission is not multiplied by Modulate.A. Alpha=0 therefore does not reliably disable the whole decal.
GetNormalFadefloat
public float GetNormalFade();floatGetSizeVector3
public Vector3 GetSize();Reads Size from this instance. The value alone does not establish visible projection onto a surface.
Vector3Full projection-volume dimensions along local axes. X/Z define texture coverage and Y defines depth. The volume must intersect the surface. Assignment clamps every component to at least 0.001; these are not half-extents.
GetTextureTexture2D
public Texture2D GetTexture(Decal.DecalTexture type);Reads the resource assigned to the selected channel. Does not capture projection output or return a surface image.
| Name | Type | Default |
|---|---|---|
type | Decal.DecalTexture | — |
typeAlbedo, Normal, Orm or Emission channel. Do not pass Max.
Texture2DAssigned Texture2D, or null for an empty channel. A resource reference does not establish decal visibility.
GetUpperFadefloat
public float GetUpperFade();floatIsDistanceFadeEnabledbool
public bool IsDistanceFadeEnabled();boolSetAlbedoMixvoid
public void SetAlbedoMix(float energy);Sets AlbedoMix. Base-color modification weight. Zero retains the original surface albedo but does not disable Normal/ORM when TextureAlbedo provides an alpha mask. Use Visible=false to disable the entire instance.
| Name | Type | Default |
|---|---|---|
energy | float | — |
energyAlbedo blend weight, normally 0…1. Despite the name energy, this is not EmissionEnergy.
SetCullMaskvoid
public void SetCullMask(uint mask);Sets CullMask. Receiver rendering-layer bitmask. The decal applies when it overlaps the mesh VisualInstance3D.Layers. This is not PhysicsBody3D.CollisionLayer or a single layer number. The example CullMask=2 selects floor meshes with Layers=2.
| Name | Type | Default |
|---|---|---|
mask | uint | — |
maskReceiver rendering-layer bitmask; zero selects no layers.
SetDistanceFadeBeginvoid
public void SetDistanceFadeBegin(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetDistanceFadeLengthvoid
public void SetDistanceFadeLength(float distance);| Name | Type | Default |
|---|---|---|
distance | float | — |
SetEmissionEnergyvoid
public void SetEmissionEnergy(float energy);| Name | Type | Default |
|---|---|---|
energy | float | — |
SetEnableDistanceFadevoid
public void SetEnableDistanceFade(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetLowerFadevoid
public void SetLowerFade(float fade);| Name | Type | Default |
|---|---|---|
fade | float | — |
SetModulatevoid
public void SetModulate(Color color);Sets Modulate. RGB multiplies albedo and emission colors. Alpha attenuates albedo and its mask-driven Normal/ORM blending; emission is not multiplied by Modulate.A. Alpha=0 therefore does not reliably disable the whole decal.
| Name | Type | Default |
|---|---|---|
color | Color | — |
colorRGB color multiplier and alpha for the albedo/Normal/ORM mask. Alpha does not disable emission.
SetNormalFadevoid
public void SetNormalFade(float fade);| Name | Type | Default |
|---|---|---|
fade | float | — |
SetSizevoid
public void SetSize(Vector3 size);Sets Size. Full projection-volume dimensions along local axes. X/Z define texture coverage and Y defines depth. The volume must intersect the surface. Assignment clamps every component to at least 0.001; these are not half-extents.
| Name | Type | Default |
|---|---|---|
size | Vector3 | — |
sizeFull local dimensions. Every component is clamped to at least 0.001.
SetTexturevoid
public void SetTexture(Decal.DecalTexture type, Texture2D texture);Assigns a texture to the specified decal channel. null clears the channel. Normal/ORM require a separate TextureAlbedo alpha mask; Emission is processed independently.
| Name | Type | Default |
|---|---|---|
type | Decal.DecalTexture | — |
texture | Texture2D | — |
typeDecalTexture.Albedo, Normal, Orm or Emission channel. Max is an enum bound, not a channel.
textureTexture for the selected channel, or null to remove it. Check the particular Texture2D subtype: a viewport reference is not a regular imported decal-atlas texture.
SetUpperFadevoid
public void SetUpperFade(float fade);| Name | Type | Default |
|---|---|---|
fade | float | — |
Decal.DecalTexture
| Value | Description |
|---|---|
Albedo = 0 |
|
Emission = 3 |
|
Max = 4 | Max size of |
Normal = 1 |
|
Orm = 2 |
|