playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
3 lines (2 loc) • 684 B
TypeScript
declare const _default: "\nvec3 toneMap(vec3 color) {\n\n color *= getExposure();\n\n float startCompression = 0.8 - 0.04;\n float desaturation = 0.15;\n\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return color;\n\n float d = 1. - startCompression;\n float newPeak = 1. - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n\n float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n return mix(color, newPeak * vec3(1, 1, 1), g);\n}\n";
export default _default;