This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

Hello!
I'm trying to invert the colors from the screen. I tried the shader system but I'm not really experiences with shaders or where i should put the shader. I searched something about a backbuffer copy, but didn't really understood it very well. If someone could help me on how is this done, or direct me to where i could learn this? I did tried searching for invert color shaders in GLSL and tried to replicate it in Godot, to no success.

Thanks!

in Engine by (82 points)

1 Answer

+2 votes
Best answer

look at screen-space-shaders demo: there is negative effect.
https://github.com/godotengine/godot-demo-projects/blob/master/2d/screen_space_shaders/screen_shaders.tscn#L87
it uses backbuffer.

Also you can use Viewport render to texture, then ViewportSprite, and then put a material with custom shader on it: COLOR.rgb = vec3(1.0) - texture(TEXTURE, UV);

Guess, performance and memory usage should be the same, but first method is simplier

by (48 points)
selected by

Thank you very much! :D

First method is indeed simpler. Just implement the shader onto the material of a CanvasItem then make anything to be inverted child of that node.

Pro tip: It works for the GUI objects also!

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.