Skip to content

Commit

Permalink
Merge pull request #289 from hannobraun/shading
Browse files Browse the repository at this point in the history
Shade "back sides" the same as "front sides"
  • Loading branch information
hannobraun authored Mar 5, 2022
2 parents db8e01a + 4244676 commit 6db7346
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/graphics/shader.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let pi: f32 = 3.14159265359;
fn frag_model(in: VertexOutput) -> [[location(0)]] vec4<f32> {
let light = vec3<f32>(0.0, 0.0, -1.0);

let angle = acos(dot(light, -in.normal));
let angle = acos(abs(dot(light, -in.normal)));
let f_angle = angle / (pi / 2.0);

let f_normal = max(1.0 - f_angle, 0.0);
Expand Down

0 comments on commit 6db7346

Please sign in to comment.