Skip to content

Commit

Permalink
used WorldNormalInstead of R in lighting.glgl
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanKoundal committed Oct 31, 2023
1 parent 6fec78a commit 94e639b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/webgl/shaders/lighting.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ vec3 calculateImageDiffuse( vec3 vNormal, vec3 vViewPosition ){
// make 2 seperate builds
vec3 worldCameraPosition = vec3(0.0, 0.0, 0.0); // hardcoded world camera position
vec3 worldNormal = normalize(vNormal);
vec3 lightDirection = normalize( vViewPosition - worldCameraPosition );
vec3 R = reflect(lightDirection, worldNormal);
// vec3 lightDirection = normalize( vViewPosition - worldCameraPosition );
// vec3 R = reflect(lightDirection, worldNormal);
// use worldNormal instead of R
vec2 newTexCoor = mapTextureToNormal( R );
vec2 newTexCoor = mapTextureToNormal( worldNormal );
vec4 texture = TEXTURE( environmentMapDiffused, newTexCoor );
// this is to make the darker sections more dark
// png and jpg usually flatten the brightness so it is to reverse that
Expand Down

0 comments on commit 94e639b

Please sign in to comment.