diff --git a/src/sample/deferredRendering/fragmentWriteGBuffers.wgsl b/src/sample/deferredRendering/fragmentWriteGBuffers.wgsl index 3cd2f652..f90d0554 100644 --- a/src/sample/deferredRendering/fragmentWriteGBuffers.wgsl +++ b/src/sample/deferredRendering/fragmentWriteGBuffers.wgsl @@ -15,7 +15,7 @@ fn main( let c = 0.2 + 0.5 * ((uv.x + uv.y) - 2.0 * floor((uv.x + uv.y) / 2.0)); var output : GBufferOutput; - output.normal = vec4(fragNormal, 1.0); + output.normal = vec4(normalize(fragNormal), 1.0); output.albedo = vec4(c, c, c, 1.0); return output; diff --git a/src/sample/shadowMapping/fragment.wgsl b/src/sample/shadowMapping/fragment.wgsl index e49e9185..6a45e347 100644 --- a/src/sample/shadowMapping/fragment.wgsl +++ b/src/sample/shadowMapping/fragment.wgsl @@ -37,7 +37,7 @@ fn main(input : FragmentInput) -> @location(0) vec4 { } visibility /= 9.0; - let lambertFactor = max(dot(normalize(scene.lightPos - input.fragPos), input.fragNorm), 0.0); + let lambertFactor = max(dot(normalize(scene.lightPos - input.fragPos), normalize(input.fragNorm)), 0.0); let lightingFactor = min(ambientFactor + visibility * lambertFactor, 1.0); return vec4(lightingFactor * albedo, 1.0);