linearFromSrgb function

Vector4 linearFromSrgb(
  1. double r,
  2. double g,
  3. double b, [
  4. double a = 1.0,
])

A colour picked on screen, as the linear RGBA a vertex colour is.

For vertex colours, not for baseColor. The two are on opposite sides of the curve: a material's tint is sRGB-encoded and every shader converts it, while a vertex colour is linear, as glTF's COLOR_0 is, and goes into the lighting as it stands. A green picked in a paint program and written straight into a vertex comes out pale, which is what a game building its scenery out of painted shapes finds first. Alpha is linear on both sides and passes through.

Implementation

Vector4 linearFromSrgb(double r, double g, double b, [double a = 1.0]) =>
    Vector4(srgbToLinear(r), srgbToLinear(g), srgbToLinear(b), a);