โ† All examples

godot shaders

Animated film grain with luminance response

Add moving film grain whose strength follows image brightness (strongest in midtones), with adjustable grain size, colour or monochrome grain, and a gentle exposure flicker.

Recorded render of Animated film grain with luminance response

What this component contains

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

How it works

Shader type
spatial
Render modes
unshaded, cull_disabled, depth_test_disabled, depth_draw_never, skip_vertex_transform, fog_disabled
Parameters
screen_texture (sampler2D), amount (float = 0.35), grain_size (float = 1.6), color_grain (float = 0.25), midtone_bias (float = 0.7), frames_per_second (float = 24), flicker (float = 0.03)
Use it on
A MeshInstance3D with a 2 x 2 QuadMesh, `material.tres` as its material override and a large extra cull margin, as in `demo.tscn`.
Result
The scene with fine flickering grain most visible in its midtones.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/post_film_grain/

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

Hashed white noise, not a scanned film stock: grain has no clumping or shape. Visible grain changes with resolution because it is sized in screen pixels. The pass reads Godot's screen texture after opaque geometry, so transparent objects drawn after it are not processed and its order among other transparent passes is not controlled.