Is it possible to apply multiple shaders to a single Sprite?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By The_Duskitty
:warning: Old Version Published before Godot 3 was released.

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?

:bust_in_silhouette: Reply From: Poobslag

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)

:bust_in_silhouette: Reply From: jeudyx

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.

:bust_in_silhouette: Reply From: klaas

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