提交 dfe59fa5 编写于 作者: W WestLangley

Corrected calculation of reflection vector

上级 62c8e876
......@@ -91,13 +91,18 @@ THREE.ShaderChunk = {
" vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );",
// http://en.wikibooks.org/wiki/GLSL_Programming/Applying_Matrix_Transformations
// "Transforming Normal Vectors with the Inverse Transformation"
" vec3 worldNormal = normalize( vec3( vec4( normal, 0.0 ) * viewMatrix ) );",
" if ( useRefract ) {",
" reflectVec = refract( cameraToVertex, normal, refractionRatio );",
" reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );",
" } else { ",
" reflectVec = reflect( cameraToVertex, normal );",
" reflectVec = reflect( cameraToVertex, worldNormal );",
" }",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册