@@ -4,10 +4,10 @@ precision highp float;
44precision highp int ;
55
66uniform mat4 uViewMatrix;
7+ uniform mat3 uCameraNormalMatrix;
78
89uniform bool uUseLighting;
910
10- uniform mat3 uCameraRotation;
1111uniform int uDirectionalLightCount;
1212uniform vec3 uLightingDirection[5 ];
1313uniform vec3 uDirectionalDiffuseColors[5 ];
@@ -108,7 +108,7 @@ vec2 mapTextureToNormal( vec3 v ){
108108vec3 calculateImageDiffuse(vec3 vNormal, vec3 vViewPosition, float metallic){
109109 // make 2 seperate builds
110110 vec3 worldCameraPosition = vec3 (0.0 , 0.0 , 0.0 ); // hardcoded world camera position
111- vec3 worldNormal = normalize (vNormal * uCameraRotation );
111+ vec3 worldNormal = normalize (vNormal * uCameraNormalMatrix );
112112 vec2 newTexCoor = mapTextureToNormal( worldNormal );
113113 vec4 texture = TEXTURE( environmentMapDiffused, newTexCoor );
114114 // this is to make the darker sections more dark
@@ -120,7 +120,7 @@ vec3 calculateImageSpecular(vec3 vNormal, vec3 vViewPosition, float shininess, f
120120 vec3 worldCameraPosition = vec3 (0.0 , 0.0 , 0.0 );
121121 vec3 worldNormal = normalize (vNormal);
122122 vec3 lightDirection = normalize ( vViewPosition - worldCameraPosition );
123- vec3 R = reflect (lightDirection, worldNormal) * uCameraRotation ;
123+ vec3 R = reflect (lightDirection, worldNormal) * uCameraNormalMatrix ;
124124 vec2 newTexCoor = mapTextureToNormal( R );
125125#ifdef WEBGL2
126126 // In p5js the range of shininess is >= 1,
0 commit comments