Home

Search IconIcon to open search

Colors

# GLSL

They’re just plain RGB. They’re linear. It’s good for manipulating them, but not so good for the human perception. See Computer Color is Broken video by Minute Physics and this shadertoy for examples of artifacts. See also this article, “Managing colors” section.

Before returning the final color, you should apply gamma correction to it (usually 2.2) or convert it to sRGB color space, which most monitors use. See this shadertoy which compares all 3 ways.

Also note that texture colors are also stored in sRGB, so when you fetch them, you (ideally) should convert them to linear RGB before any manipulation. Example: col = pow(tex,vec4(2.2)).

# Useful