Invert Screen Colors

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

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.


:bust_in_silhouette: Reply From: gorgo

look at screen-space-shaders demo: there is negative effect.
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

Thank you very much! :smiley:

Victor Hernandez Can | 2016-08-31 02:42

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!

gau_veldt | 2016-08-31 12:45