소스 검색

Use cameraPosition uniform instead of world origin (#26766)

StrandedKitty 1 년 전
부모
커밋
0b0a7d75ad
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 3
      examples/jsm/objects/Sky.js

+ 1 - 3
examples/jsm/objects/Sky.js

@@ -138,8 +138,6 @@ Sky.SkyShader = {
 		uniform float mieDirectionalG;
 		uniform vec3 up;
 
-		const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );
-
 		// constants for atmospheric scattering
 		const float pi = 3.141592653589793238462643383279502884197169;
 
@@ -169,7 +167,7 @@ Sky.SkyShader = {
 
 		void main() {
 
-			vec3 direction = normalize( vWorldPosition - cameraPos );
+			vec3 direction = normalize( vWorldPosition - cameraPosition );
 
 			// optical length
 			// cutoff angle at 90 to avoid singularity in next formula.