depth_shaders icon indicating copy to clipboard operation
depth_shaders copied to clipboard

How to invert white and black colors in the "Depth Shader Test (Fog)" shader?

Open Not-Adam opened this issue 4 years ago • 1 comments

I know this isn't an issue, but just wanted a way to contact you about this. I'm very new to GLSL, and have been trying to invert the white and black color ranges in that shader test to have a black fog with a white surrounding, how could I achieve this?

Not-Adam avatar Jun 09 '21 23:06 Not-Adam

Sorry, didn't see this, but if you want to just invert the entire output color you can do

gl_FragColor = vec4(vec3(1.0) - col.rgb, col.a);

Alternatively, invert the depth at the top

depth = 1.0 - depth;

onnowhere avatar Jul 13 '22 00:07 onnowhere