Remove redundant math in tonemapping. (#9669)

# Objective

- Tony McMapface has some math that cancels out.

## Solution

- Remove it.
This commit is contained in:
Griffin 2023-09-02 14:11:40 -07:00 committed by GitHub
parent ea734ab5f4
commit e88b6c8ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,18 +92,11 @@ fn somewhat_boring_display_transform(col: vec3<f32>) -> vec3<f32> {
// By Tomasz Stachowiak // By Tomasz Stachowiak
// https://github.com/h3r2tic/tony-mc-mapface // https://github.com/h3r2tic/tony-mc-mapface
const TONY_MC_MAPFACE_LUT_EV_RANGE = vec2<f32>(-13.0, 8.0);
const TONY_MC_MAPFACE_LUT_DIMS: f32 = 48.0; const TONY_MC_MAPFACE_LUT_DIMS: f32 = 48.0;
fn tony_mc_mapface_lut_range_encode(x: vec3<f32>) -> vec3<f32> {
return x / (x + 1.0);
}
fn sample_tony_mc_mapface_lut(stimulus: vec3<f32>) -> vec3<f32> { fn sample_tony_mc_mapface_lut(stimulus: vec3<f32>) -> vec3<f32> {
let range = tony_mc_mapface_lut_range_encode(exp2(TONY_MC_MAPFACE_LUT_EV_RANGE.xyy)).xy; var uv = (stimulus / (stimulus + 1.0)) * (f32(TONY_MC_MAPFACE_LUT_DIMS - 1.0) / f32(TONY_MC_MAPFACE_LUT_DIMS)) + 0.5 / f32(TONY_MC_MAPFACE_LUT_DIMS);
let normalized = (tony_mc_mapface_lut_range_encode(stimulus) - range.x) / (range.y - range.x); return sample_current_lut(saturate(uv)).rgb;
var uv = saturate(normalized * (f32(TONY_MC_MAPFACE_LUT_DIMS - 1.0) / f32(TONY_MC_MAPFACE_LUT_DIMS)) + 0.5 / f32(TONY_MC_MAPFACE_LUT_DIMS));
return sample_current_lut(uv).rgb;
} }
// --------------------------------- // ---------------------------------