+11 votes

Basically i figured out part of my question, but it only seems to work on a single shader, is there a way to add more than one shader or is there only able to be a single shader?

in Engine by (483 points)

3 Answers

+1 vote

There is no way to have multiple shaders on one node as a shader is just a set of instructions for how to draw an object. You can't have multiple conflicting sets of instructions.

With 3D materials however, you can conceptually have multiple shaders by running shaders one-after-the-other. This is done by selecting a second shader to be run on "Next pass".

With 2D materials, this is not possible as it would just render the second sprite on top of the first and you wouldnt see the effects of the first shader.

(source)

by (136 points)
0 votes

My poor man's solution to this need was to have a duplicate sprite with the second shader I needed, and switch visibility as needed.

by (16 points)
+3 votes

Hi
you can have multiply passes with different shaders. Use the NextPass property of the first shader to assign another material. This obviously doubles the draw counts.

My poor man's solution to this need was to have a duplicate sprite with the second shader I needed, and switch visibility as needed.

You can just switch the material on your sprite.

sprite.material = other_material
by (4,048 points)
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 webmaster@godotengine.org with your username.