From 5fe777718fef1bcdc32b0a217989d1f8e320fe5f Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Mon, 1 Nov 2021 15:11:58 -0400 Subject: [PATCH] Fixed G Norm --- src/shaders/deferred.frag.glsl.js | 3 ++- src/shaders/deferredToTexture.frag.glsl | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shaders/deferred.frag.glsl.js b/src/shaders/deferred.frag.glsl.js index 0535941..5e1fc13 100644 --- a/src/shaders/deferred.frag.glsl.js +++ b/src/shaders/deferred.frag.glsl.js @@ -96,7 +96,8 @@ export default function(params) { void main() { // TODO: extract data from g buffers and do lighting vec4 gbPos = texture2D(u_gbuffers[0], v_uv); - vec4 gbNor = texture2D(u_gbuffers[1], v_uv); + vec4 gNor = texture2D(u_gbuffers[1], v_uv); + vec4 gbNor = vec4(oct_to_float32x3(vec2(gNor.x, gNor.y)), 1.0); vec4 albedo = texture2D(u_gbuffers[2], v_uv); vec3 fragColor = vec3(0.0); diff --git a/src/shaders/deferredToTexture.frag.glsl b/src/shaders/deferredToTexture.frag.glsl index 844542b..a381bac 100644 --- a/src/shaders/deferredToTexture.frag.glsl +++ b/src/shaders/deferredToTexture.frag.glsl @@ -43,7 +43,7 @@ void main() { // TODO: populate your g buffer gl_FragData[0] = vec4(v_position, 1.0); - gl_FragData[1] = vec4(norm, 1.0); + gl_FragData[1] = vec4(float32x3_to_Oct(norm), 0.0, 1.0); gl_FragData[2] = vec4(col, 1.0); // gl_FragData[3] = ?? } \ No newline at end of file