improve baked lighting and improve wireframe perf

This commit is contained in:
asrael 2026-02-06 23:28:02 -06:00
parent 8c0777b547
commit 13263b91c6
5 changed files with 59 additions and 17 deletions

View file

@ -533,8 +533,9 @@ fn compute_vertex_light(
let light_dir = to_light.normalize();
let ndotl = normal.dot(light_dir).max(0.0);
let attenuation = (1.0 - dist / light.radius).max(0.0);
let attenuation = attenuation * attenuation;
let dist_sq = to_light.dot(to_light);
let radius_sq = light.radius * light.radius;
let attenuation = (1.0 - dist_sq / radius_sq).max(0.0);
total += light.intensity * ndotl * attenuation;
}
@ -1056,7 +1057,7 @@ pub fn generate_rooms(params: &ProcgenParams) -> Bsp {
Some(LightSource {
position: Vec3::new(cx, light_height, cz),
intensity: 1.8,
intensity: 1.5,
radius: 160.0,
})
}).collect();