From 726f435d29d9c341fad8dc9fdcda3ffdfbb320e8 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 9 Jan 2025 20:19:43 +0100 Subject: proper attenuation calculation --- world/src/mesh.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'world/src/mesh.rs') diff --git a/world/src/mesh.rs b/world/src/mesh.rs index 7352583..a38980e 100644 --- a/world/src/mesh.rs +++ b/world/src/mesh.rs @@ -282,7 +282,8 @@ pub fn import_mesh( let g_attenuation = p.material().volume().map(|v| { let ref_dist = v.attenuation_distance(); Vec3A::from_array(v.attenuation_color().map( - |factor| factor * ref_dist, // TODO figure out how that is converted + // manually derived from attenuation coefficient formula. i hope this is correct. + |factor| -(factor.powf(1. / ref_dist)).ln(), )) }); let g_refractive_index = p.material().ior(); -- cgit v1.2.3-70-g09d2