โ† All examples

godot shaders

Inner outline along a sprite's edge

Draw a border of a chosen width inside the opaque shape of a sprite, following its silhouette, with optional pulsing and an option to hide the interior so only the inner line remains.

Recorded render of Inner outline along a sprite's edge

What this component contains

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

How it works

Shader type
canvas_item
Parameters
line_color (vec4 = 1, 0.95, 0.4, 1), width (int = 2), alpha_cutoff (float = 0.5), keep_interior (bool = yes), pulse_speed (float = 0)
Use it on
A Sprite2D (or other textured CanvasItem) with transparent space around its shape, assigned to the node as usual.
Result
The sprite's blobs with a yellow border running just inside their edges.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/sprite_inner_outline/

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

Cost grows with the square of `width`. With texture filtering and scaling, edges are as soft as the sampled alpha. Atlas regions need padding or neighbouring sprites count as opaque.