0 votes

I'm relatively new to Godot and to shaders.

I added a shader to my game that has chromatic aberration, it looks pretty cool. But it messes with other text labels that are not its parent or child node, and I don't really understand why that happens.

Here are the screenshots.

Thank you!

Godot version 3.4
in Engine by (15 points)

1 Answer

+1 vote
Best answer

You are giving your screen texture and screen cordinates to shader as an input so shader affects you whole screen without looking your node tree. There 2 ways to deal with it.
1-) Replace all "SCREENTEXTURE" with "TEXTURE" and "SCREENUV" with "UV" in your shader and add your shader material one by one to all nodes except for your labels.(easy way)
2-)You can use your screen as a texture with using viewport node and later add your labels above it. Documents explain this well(https://docs.godotengine.org/en/stable/tutorials/shaders/custom_postprocessing.html)(if there is something you don't understand please ask)

by (151 points)
selected by
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.