瀏覽代碼

Update envmap_fragment.glsl

Per https://github.com/mrdoob/three.js/issues/11367#issuecomment-308303716
Equirectangular U sampling update to intuitively equiangular-per-raster sampling.

A quick visual test shows no change from the old version, which worries me a bit, since I'm not getting the trig-on-paper to give identical results.  If the math DOES work out provably identically, the original version is certainly more efficient.
NNskelly 8 年之前
父節點
當前提交
a40bb34eec
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/renderers/shaders/ShaderChunk/envmap_fragment.glsl

+ 1 - 1
src/renderers/shaders/ShaderChunk/envmap_fragment.glsl

@@ -30,7 +30,7 @@
 	#elif defined( ENVMAP_TYPE_EQUIREC )
 
 		vec2 sampleUV;
-		sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
+		sampleUV.y = asin( flipNormal * reflectVec.y) * RECIPROCAL_PI + 0.5;
 		sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
 		vec4 envColor = texture2D( envMap, sampleUV );