Baltor Get started

Gallery / Godot shaders

Box-projected decal from the depth buffer

In your harnessGodot shaderMIT

Project a decal onto whatever geometry lies inside a box: the box's pixels rebuild the scene position from depth, move it into the box's local space, discard outside the box, fade on steep surfaces, and draw a procedural emblem or an assigned image.

Render of Box-projected decal from the depth buffer
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

Shader type
spatial
Render modes
unshaded, cull_front, depth_test_disabled, depth_draw_never, shadows_disabled
Parameters
depth_texture (sampler2D), decal_texture (sampler2D), decal_color (vec4 = 0.95, 0.75, 0.1, 1), accent_color (vec4 = 0.08, 0.08, 0.08, 1), opacity (float = 0.9), angle_fade (float = 0.4), edge_fade (float = 0.05), stripe_count (int = 10) and 1 more
Use it on
A unit BoxMesh node scaled and rotated to the decal volume; its local Y is the projection axis., Optional: a decal image for decal_texture.
Result
A yellow and black hazard disc painted across the floor and wrapping onto the crate inside the box.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/depth_decal_projector/

Limits. Projects onto every opaque surface in the box, including moving characters; filter with layers if needed. Transparent objects are not in the depth buffer. The decal does not receive lighting (unshaded). Reconstructed normals are flat per pixel quad and can flicker at depth discontinuities.

Details

Kind
Godot shader
Engine
Godot 4.3 or later
Files
11 files, 55.6 KB
Licence
MIT
Declared effects
reads files, runs commands
Checked with
Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
Checks
contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
Techniques
Deferred (screen-space) decal by depth reconstruction into box space, Normal from derivatives of the reconstructed position, Procedural emblem
Tags
godot shader, spatial, decal, projection, depth buffer, deferred decal, graffiti
Identity
library.supply.creative_originals.782faf0d8ed89d260b07949c.31b45df5b6bc0fdf
Version
31b45df5b6bc0fdf620e69a557bc69632e0e906fcb30f1e46ea843f54d219c2f

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.