+3 votes

I am working on a 2D game in Godot (3.2.3), and I would like to use shaders to modify my sprites--flash on taking damage, green tint when poisoned, etc. On the surface this seems seems pretty straightforward, and it would be if each of my objects only used a single sprite node. But many of them use 2 or 3 for animation flexibility, e.g. a turrent with separate sprites for the base and the gun itself. At best, this means I would have to apply the shader separately to each sprite, which results in a lot of messy bookkeeping and is prone to errors. At worst, it doesn't work at all, like if I wanted to display a single outline around a whole multi-sprite object.

I've seen some forum posts that say this isn't possible, it's just a limitation of Godot, but those are at least a couple of years old. I've also seen a couple of posts ([1], [2]) about using a combination of BackBufferCopy and TextureRect nodes to do roughly what I'm trying to do, but it seems like that method applies the shader to anything that has been rendered at the time it runs--so the shader needs to be able to discriminate foreground from background, and applying it to more than one object would cause problems.

So is there any way to prerender a group of sprites so that I can run a shader on the group as a whole? Or is this still a dead end?

in Engine by (15 points)

Please log in or register to answer this question.

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.