tonemapBy function

Vector3 tonemapBy(
  1. Vector3 color,
  2. int curve
)

TonemapBy from composite.frag: whichever curve the number names.

The numbers are TonemapCurve's own and are part of the uniform layout — see composite.frag's note on why 1 is the default rather than 0.

Code 6 is a display transform the composite reads from a table; with no table to hand, this answers with the function the engine's own table is baked from — tonemapAces2 — which the table approximates to its sampling.

Implementation

Vector3 tonemapBy(Vector3 color, int curve) => switch (curve) {
  1 => tonemapNeutral(color),
  2 => tonemapAces(color),
  3 => tonemapAgx(color),
  4 => tonemapReinhard(color),
  5 => tonemapAgxFull(color),
  6 => tonemapAces2(color),
  _ => color,
};