Skip to content

Instantly share code, notes, and snippets.

@SpineyPete
SpineyPete / colorspaces.glsl
Last active June 9, 2017 13:57
Colorspace Conversions
#version 330
// Colorspace conversions, I haven't checked the validity of this stuff.
// Some of them cause discolorations when transformed to and back so I'm
// probably doing wrong things that I don't understand -- Caveat emptor.
// CIELab XYZ
// ----------
// Matrices borrowed from Fundamentals Of Computer Graphics (3rd edition).
@SpineyPete
SpineyPete / tonemappers.glsl
Last active April 11, 2025 07:34
Tonemappers
#version 330
// Tonemapping
// -----------
// Some of these are attributed to certain games.
// But this is mostly secondhand info, so take it with a grain of salt.
vec3 Tonemap_Reinhard(vec3 x) {
// Simplest Reinhard tonemapper.