Hello everyone,
I want to apply a blur effect multiple times in my 2D scene. I have a ParallaxBackground with several ParallaxLayer nodes underneath. Between them, I have a ColorRect node with a blur shader. However, as soon as I enable the second shader, it stops working as expected.
I want the blur effect to be strongest on the farthest layer. Would this even work the way I intend?
I understand what you’re trying to achieve with layered blur effects in your ParallaxBackground setup. The issue you’re encountering is common when working with multiple post-processing effects in Godot.
The reason your second shader isn’t working as expected is likely because:
Each blur shader is sampling from the already rendered scene
When you stack multiple blurs, they don’t operate independently on specific layers as you might expect
For a progressive blur effect where distant layers are more blurred, Try something like this:
# In your ParallaxLayer setup
var blur_material = ShaderMaterial.new()
blur_material.shader = preload("res://blur_shader.gdshader")
blur_material.set_shader_parameter("blur_amount", distance_factor) # More for farther layers
$ParallaxLayer1.material = blur_material # Strongest blur
$ParallaxLayer2.material = blur_material.duplicate() # Medium blur
# etc.