playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
22 lines (21 loc) • 560 B
JavaScript
var tonemappingFilmic_default = `
const A: f32 = 0.15;
const B: f32 = 0.50;
const C: f32 = 0.10;
const D: f32 = 0.20;
const E: f32 = 0.02;
const F: f32 = 0.30;
const W: f32 = 11.2;
fn uncharted2Tonemap(x: vec3f) -> vec3f {
return ((x * (A * x + C * B) + D * E) / (x * (A * x + B) + D * F)) - vec3f(E / F);
}
fn toneMap(color: vec3f) -> vec3f {
var c: vec3f = uncharted2Tonemap(color * getExposure());
let whiteScale: vec3f = vec3f(1.0) / uncharted2Tonemap(vec3f(W, W, W));
c *= whiteScale;
return c;
}
`;
export {
tonemappingFilmic_default as default
};