Apply shader on a single CanvasLayer?

Godot Version

4.5

Question

Hi,
I’d like to apply a shader on all items contained in a CanvasLayer at once, all over the screen, but leaving other canvaslayers untouched…
Note that I do not want to apply this shader on every concerned items one by one (even using “use parent material”), because the result is not the same : UVs are then calculated on the base of each item hich does not give a consistent result…
I cannot find out which item to add to glue all the items of the canvaslayer, nor what to specify in my shader. Should I use UV or SCREEN_UV ? Shoud I use a uniform sampler2D with hint_screen_texture ? But how can I limit this to a single canvaslayer ?
It’s really not clear to me.

CanvasLayers aren’t frame buffers so shaders cannot be applied to them as if a group, you can use a SubViewport to shader a couple of nodes at once.

1 Like

You may want to use CanvasGroup instead.

I tried and that is a solution. For those who wants more, it seems that you need to pack the subviewport in a subviewport container, and apply the shader to this container. It works.

I tried to use CanvasGroup, but cannot get a proper result…

Well, if viewport is working the use that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.