소스 검색

fix sample direction cubemap

fazeaction 8 년 전
부모
커밋
8476221652
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      examples/js/pmrem/PMREMCubeUVPacker.js

+ 6 - 6
examples/js/pmrem/PMREMCubeUVPacker.js

@@ -156,17 +156,17 @@ THREE.PMREMCubeUVPacker.prototype = {
 					uv = uv * 2.0 - 1.0;\
 					uv = uv * 2.0 - 1.0;\
 					uv.y *= -1.0;\
 					uv.y *= -1.0;\
 					if(faceIndex == 0) {\
 					if(faceIndex == 0) {\
-						sampleDirection = normalize(vec3(1.0, uv.y, -uv.x));\
+						sampleDirection = normalize(vec3(-1.0, uv.y, -uv.x));\
 					} else if(faceIndex == 1) {\
 					} else if(faceIndex == 1) {\
-						sampleDirection = normalize(vec3(uv.x, 1.0, uv.y));\
+						sampleDirection = normalize(vec3(-uv.x, 1.0, uv.y));\
 					} else if(faceIndex == 2) {\
 					} else if(faceIndex == 2) {\
-						sampleDirection = normalize(vec3(uv.x, uv.y, 1.0));\
+						sampleDirection = normalize(vec3(-uv.x, uv.y, 1.0));\
 					} else if(faceIndex == 3) {\
 					} else if(faceIndex == 3) {\
-						sampleDirection = normalize(vec3(-1.0, uv.y, uv.x));\
+						sampleDirection = normalize(vec3(1.0, uv.y, uv.x));\
 					} else if(faceIndex == 4) {\
 					} else if(faceIndex == 4) {\
-						sampleDirection = normalize(vec3(uv.x, -1.0, -uv.y));\
+						sampleDirection = normalize(vec3(-uv.x, -1.0, -uv.y));\
 					} else {\
 					} else {\
-						sampleDirection = normalize(vec3(-uv.x, uv.y, -1.0));\
+						sampleDirection = normalize(vec3(uv.x, uv.y, -1.0));\
 					}\
 					}\
 					vec4 color = envMapTexelToLinear( textureCube( envMap, sampleDirection ) );\
 					vec4 color = envMapTexelToLinear( textureCube( envMap, sampleDirection ) );\
 					gl_FragColor = linearToOutputTexel( color );\
 					gl_FragColor = linearToOutputTexel( color );\