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?

in Engine by (30 points)

1 Answer

+2 votes
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.

by (29,034 points)
selected by

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.