โ† All examples

godot shaders

Full-screen ink edges from depth and colour

Draw ink lines over a 3D scene where depth or colour changes sharply: a Laplacian of inverse depth finds silhouettes and creases, a Sobel filter on luminance finds colour borders. Optional paper tint for a drawn look.

Recorded render of Full-screen ink edges from depth and colour

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • post_edge_detect.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), depth_texture (sampler2D), line_color (vec4 = 0.05, 0.05, 0.08, 1), line_width (float = 1), depth_sensitivity (float = 8), color_sensitivity (float = 1.5), threshold (float = 0.3), paper_mix (float = 0) and 1 more
Result
The scene with dark lines along silhouettes, creases and colour borders, optionally faded toward paper.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/post_edge_detect/

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

Lines are found in screen space, so their width is in pixels and does not scale with distance. Transparent objects are not in the depth buffer and only get colour edges. Very distant geometry can produce faint depth lines from precision. The pass sees only what is drawn before it; draw order relative to other transparent passes is not controlled.