KWCDYED7S3JSVY7XLRPEJBIWW52NEZ4SSXRRVP5DV7MCZQU7LPXAC
#define_import_path hdr
// Maps HDR values to linear values
// Based on http://www.oscars.org/science-technology/sci-tech-projects/aces
fn aces_tone_map(hdr: vec3<f32>) -> vec3<f32> {
let m1 = mat3x3(
0.59719, 0.07600, 0.02840,
0.35458, 0.90834, 0.13383,
0.04823, 0.01566, 0.83777,
);
let m2 = mat3x3(
1.60475, -0.10208, -0.00327,
-0.53108, 1.10813, -0.07276,
-0.07367, -0.00605, 1.07602,
);
let v = m1 * hdr;
let a = v * (v + 0.0245786) - 0.000090537;
let b = v * (0.983729 * v + 0.4329510) + 0.238081;
return clamp(m2 * (a / b), vec3(0.0), vec3(1.0));
}
let hdr_module_src = include_str!("../../hdr.wgsl");
let (name, imports, shader_defs) = compose::get_preprocessor_data(hdr_module_src);
composer.add_composable_module(compose::ComposableModuleDescriptor {
as_name: name,
source: hdr_module_src,
file_path: "hdr.wgsl",
language: compose::ShaderLanguage::Wgsl,
additional_imports: &imports,
shader_defs,
})?;
// let hdr_module_src = include_str!("../../hdr.wgsl");
// let (name, imports, shader_defs) = compose::get_preprocessor_data(hdr_module_src);
// composer.add_composable_module(compose::ComposableModuleDescriptor {
// as_name: name,
// source: hdr_module_src,
// file_path: "hdr.wgsl",
// language: compose::ShaderLanguage::Wgsl,
// additional_imports: &imports,
// shader_defs,
// })?;