How to add multiple shaders to a sprite

Godot Version

godot 4.3

Question

How to add multiple shaders to a sprite2D in Godot? I used CanvasGroup as a parrent of Sprite2D,and can add a second shader to the canvasGroup, but if I want to add a third shader, what should I do? I tried to add the CanvasGroup node as a child node of CanvasGroup, but the effect is not what I want. I don’t understand whether CanvasGroup can be a child node of CanvasGroup to achieve what I want.

Well it depends on what you’re trying to achieve, you can use the next pass in the ShaderMaterial itself, like so:

You can repeat this proccess how many times you need, without needing to create aditional stuff, but be aware that the order that you put the shaders does matter, meaning the very first one is firstly apllied, then it goes to next_pass and so on…

Hope this helps!

1 Like

which node you use,only 3D node have “next_pass”, I can’t find it on 2d node , what node are you use in your screenshot?

I can’t find a node inherited from CanvasItem that shows next_pass, are you using the official version?

Indeed, but its not 3D nodes but rather shaders with the type spatial

Yes I am using the official version, It only wasa that I had the shader_type to spatial instead of canvas_item.

Conclusion

After some more digging, I found that there is no next_pass for canvas_item shaders. So sadly it isn’t possible to do right now…

Thanks anyway.