Applying Shader/ShaderMaterial to textures drawn with CanvasItem.DrawTexture()

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Xx_Henry_xX

Currently I’m trying to make a bullet hell game, and as part of the optimization process I’m planning to use CanvasItem.DrawTexture() in a single bullet manager node to draw the bullets instead of using a node for each of the bullets. (see here)

The project contains a set of AtlasTexture with various blue bullet graphics, and I intend to use a ShaderMaterial to apply a hue shift and turn them into other colors.

The problem is that I haven’t found a way to do so with the method in question. If anyone can help me out I’d be grateful. Any pointers regarding the use of AtlasTexture or ShaderMaterial are also welcome.

Important: Due to the custom physics involved (for a cross-platform replay system), I’m limited to C# solutions.

A bit of clarification: I intend to draw multiple bullets with different colors, and afaik ShaderMaterial on a node influences all of the textures drawn by it, so just modifying shader parameters while having just one node draw everything is no-go. (unless I’m wrong)

Xx_Henry_xX | 2022-08-09 07:55