提交 5cb71552 编写于 作者: A alteredq

Added clamping to spotLight term in shaders.

This is necessary for OpenGL where pow(0,0) is undefined and can be negative (in DirectX you just get zero), leading to negative light creating black areas artefacts.

Fixes #1805 and #2615 (related already fixed #998).
上级 b5390e93
......@@ -14281,7 +14281,7 @@ THREE.ShaderChunk = {
"if ( spotEffect > spotLightAngle[ i ] ) {",
"spotEffect = pow( spotEffect, spotLightExponent[ i ] );",
"spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );",
"float lDistance = 1.0;",
"if ( spotLightDistance[ i ] > 0.0 )",
......@@ -14640,7 +14640,7 @@ THREE.ShaderChunk = {
"if ( spotEffect > spotLightAngle[ i ] ) {",
"spotEffect = pow( spotEffect, spotLightExponent[ i ] );",
"spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );",
// diffuse
......@@ -25447,7 +25447,7 @@ THREE.ShaderUtils = {
"if ( spotEffect > spotLightAngle[ i ] ) {",
"spotEffect = pow( spotEffect, spotLightExponent[ i ] );",
"spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );",
// diffuse
......
此差异已折叠。
......@@ -365,7 +365,7 @@ THREE.ShaderUtils = {
"if ( spotEffect > spotLightAngle[ i ] ) {",
"spotEffect = pow( spotEffect, spotLightExponent[ i ] );",
"spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );",
// diffuse
......
......@@ -610,7 +610,7 @@ THREE.ShaderChunk = {
"if ( spotEffect > spotLightAngle[ i ] ) {",
"spotEffect = pow( spotEffect, spotLightExponent[ i ] );",
"spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );",
"float lDistance = 1.0;",
"if ( spotLightDistance[ i ] > 0.0 )",
......@@ -969,7 +969,7 @@ THREE.ShaderChunk = {
"if ( spotEffect > spotLightAngle[ i ] ) {",
"spotEffect = pow( spotEffect, spotLightExponent[ i ] );",
"spotEffect = max( pow( spotEffect, spotLightExponent[ i ] ), 0.0 );",
// diffuse
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册