Skip to content

Decapitated/Compositor-Effect-Playground

Repository files navigation

Compositor Effect Playground

A Godot project for playing around with compositor effects.

Benchmarks

These benchmarks are rough estimates pulled from the Visual Debugger.

Effect Time
Stencil ~0.03ms
Extraction ~0.06ms
Jump Flood ~0.5ms
Outline ~0.02ms
Panini Projection ~0.12ms

Stencil Buffer Texture

Currently, Godot does not expose the stencil buffer to be sampled.

  • StencilEffect works around this with 8 render passes - one per bit.
  • Each pass sets compare_mask = reference = (1 << i) with COMPARE_OP_EQUAL, isolating that bit as the pass condition.
  • Passing pixels write (1 << i) as a float into the output texture
  • Additive blending (ONE + ONE, BLEND_OP_ADD) accumulates all 8 passes into the final [0-255] output.

References

Link Description
Stencil Buffer Texture Originally based on this.
CodePage12 Font texture used for debug shader.

Outlines

Stencil → Extraction → Jump Flood → Outline

References

Link Description
Outline Shader - Roystan One of the articles that inspired me to implement this after reading years ago.
Distance Field Outlines - Pink Arcana First saw it when it came out in 2024. Great learning material.
Getting started with CompositorEffects and Compute shaders - Pink Arcana Discussion on the above.

Panini Projection

Before After

FOV = 130°
FSR 2.0 → Scaling = 2.0

Project References

Link
Scene Data Include
Include Scene Data Virtually
Compute Shader Textures

About

A Godot project for playing around with compositor effects.

Resources

License

Stars

Watchers

Forks

Contributors