Multi-layer Shader Effects Node for Godot 4.4
A specialized Sprite2D subclass for multi-pass shader processing implemented via chained SubViewport nodes. Key features:
- Real-time editor preview (supports auto-refresh)
- Allows manual refresh when image anomalies occur
- Provides methods to modify specified shader properties in real-time
- Add
ShadersSprite2D.gdto your project - Use it like a regular Sprite2D. Note: Do not manually set the
texture/materialproperties - For Godot versions below 4.4: The "Generate" button and typed dictionaries may not work. Modify or remove them if needed (untested).
- Configure
shaders_texture(base texture) andshaders_dic(shader material dictionary) in the editor - Adjust
size_expandto expand viewport size if shaders exceed the original texture bounds - Modify SubViewport properties as needed for visual effects
- To customize, add
@exportproperties and modify_get_subviewport()
- To customize, add
Key Constraints:
texture/material properties (managed internally)
ShaderMaterial (recommended), CanvasItemMaterial (untested)
- SubViewport + ViewportTexture
Viewport Chain Construction:
- Create SubViewports based on
shaders_diclength (minus one) - Each SubViewport contains a centered Sprite2D node
- Hierarchical setup:
- SubViewport output feeds into the previous Sprite2D's texture
- The last Sprite2D uses
shaders_texturedirectly
- SubViewports auto-match
shaders_texturesize, with optional expansion - Recommended reading: SubViewport class reference
Example Node Structure:
ShadersSprite2D (main node, applies Material 01)
└── SubViewport1 (first viewport)
└── Sprite2D (applies Material 02)
└── SubViewport2
└── Sprite2D (applies Material 03)
└── ... (recursive to last layer)
| Description | Severity | Solution | Frequency |
|---|---|---|---|
ERROR: Path to node is invalid (editor) |
Resolved | Safe to ignore - no runtime impact | Never |
- Special thanks: https://forum.godotengine.org/u/mrcdk/summary
| Effect | Author | Source | License |
|---|---|---|---|
| Melting Screen | Shader Kitten | GodotShaders | CC0 1.0 |
| Random Shake + Flash | Rain | GodotShaders | CC0 1.0 |
- License: MIT
- Compatibility: Godot 4.4+
- Can be implemented using the
CanvasGroupnode, but requires the ability to modify shaders- Reference the shader implementation at canvas_group_shader.gdshader
- Recommended reading: CanvasGroup class reference