โ† All examples

godot shaders

Box-projected decal from the depth buffer

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.

Recorded render of Box-projected decal from the depth buffer

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • depth_decal_projector.gdshader
  • inspect_shader.py
  • material.tres
  • preview.png
  • test_package.py
  • verification/native.json

How it works

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/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

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.