โ† All examples

godot shaders

Dithered distance fade for camera occluders

Fade an opaque mesh without transparency sorting: pixels are discarded against a 4 x 4 Bayer threshold pattern as the object comes close to the camera or as a fade uniform drops, so walls and props in front of the camera become see-through.

Recorded render of Dithered distance fade for camera occluders

What this component contains

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

How it works

Shader type
spatial
Parameters
albedo (vec4 = 0.55, 0.6, 0.68, 1), roughness (float = 0.7), fade (float = 1), near_distance (float = 1), far_distance (float = 2.6), dither_scale (float = 1), use_distance (bool = yes)
Result
Pillars near the camera break into a regular dot pattern you can see through, solid further away.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/screen_door_fade/

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

The pattern is visible as a grid at low resolutions and flickers with temporal anti-aliasing off; with TAA or FSR it smooths out. Shadows use the shadow camera's distance, not the main camera's, so a faded object can still cast a full shadow.