Replace ambient coefficient with a no-shadow fill light

This commit is contained in:
Matthew Gordon 2025-01-21 20:14:52 -04:00
parent e1aab75ab8
commit 3d29a93885
1 changed files with 4 additions and 3 deletions

View File

@ -96,9 +96,10 @@ fn fs_solid(vertex: VertexOutput) -> @location(0) vec4<f32> {
let sun_direction = let sun_direction =
(uniforms.camera_to_world_matrix (uniforms.camera_to_world_matrix
* vec4<f32>(sun_direction, 0.0)).xyz; * vec4<f32>(sun_direction, 0.0)).xyz;
let lambertian_value = dot(hit_normal, sun_direction); let sun_lambertian_value = dot(hit_normal, sun_direction);
let ambient_strength = 0.25; let fill_lambertian_value = dot(hit_normal, sun_direction * vec3(1.0, -1.0, 1.0));
let l = ambient_strength + (1.0 - ambient_strength) * lambertian_value * shadow_value; let fill_strength = 0.25;
let l = fill_strength * fill_lambertian_value + (1.0 - fill_strength) * sun_lambertian_value * shadow_value;
color_accumulator += 0.25 * vec4<f32>(vec3<f32>(l), 1.0); color_accumulator += 0.25 * vec4<f32>(vec3<f32>(l), 1.0);
} }
} }