0 votes

So, I'm trying to do an interface animation with shaders, and I need to modify the appearence of mutiple nodes as if they were one. How can I achive this?

The effect I'm trying to get is a mask-like, but using light2D is a little bit expensive.

How can I modify the previously rendered objects alpha? Is there any render_modethat can do it?

asked Jul 16, 2019 in Engine by vetu11 (17 points)

1 Answer

+1 vote
Best answer

At the moment, a ShaderMaterial can only affect an object on which it is applied. If you want the same material to be applied on more than one object, re-use the same material on them and it will affect them all individually.

modify the appearence of mutiple nodes as if they were one

Can you better explain what you mean by this?

As for modifying previously rendered objects alpha, this is not possible in the current API. What is drawn is drawn, you can only get the resulting pixel color on screen. There is no individual alpha information you can get from it. The only way would be to use a render-to-texture to compose into the final render, which can only be done with a Viewport, which in turn might be quite overkill for a UI.
There might be a GPU driver feature to do what you want (at least maybe stencil buffer) but it's not exposed by the engine.

answered Jul 16, 2019 by Zylann (27,004 points)
selected Jul 16, 2019 by vetu11

By "modify the appearence of mutiple nodes as if they were one", I'd like the effect to affect all the children of a node, so with one ShaderMaterial on the parent, modify the appearence of the whole.

But with what I understand and what you answered, I think that I will have to take other way to solve this problem.

Yeah if you want all nodes to have that shader, you basically need to assign the same material to all of them.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.