Skip to content

Commit a445165

Browse files
committed
Implemented @alteredq's PointLight Shadow version using 4 taps instead of 21. See mrdoob#7153.
https://twitter.com/alteredq/status/697103627773734914
1 parent 0c60f6f commit a445165

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -213,31 +213,14 @@
213213

214214
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )
215215

216-
vec3 offset = vec3( - 1, 0, 1 ) * shadowRadius * 2.0 * texelSize.y;
216+
vec2 offset = vec2( - 1, 1 ) * shadowRadius * 2.0 * texelSize.y;
217217

218218
return (
219-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzz, texelSize.y ), dp ) +
220-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxz, texelSize.y ), dp ) +
221-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxz, texelSize.y ), dp ) +
222-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzz, texelSize.y ), dp ) +
223-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzx, texelSize.y ), dp ) +
224-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxx, texelSize.y ), dp ) +
225-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
226-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzx, texelSize.y ), dp ) +
227-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zzy, texelSize.y ), dp ) +
228-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zxy, texelSize.y ), dp ) +
229-
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
230-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
231-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xzy, texelSize.y ), dp ) +
232-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyz, texelSize.y ), dp ) +
233-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyz, texelSize.y ), dp ) +
234-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.zyx, texelSize.y ), dp ) +
235219
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
236-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yzz, texelSize.y ), dp ) +
237-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxz, texelSize.y ), dp ) +
238220
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) +
239-
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yzx, texelSize.y ), dp )
240-
) * ( 1.0 / 21.0 );
221+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
222+
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp )
223+
) * ( 1.0 / 4.0 );
241224

242225
#else // no percentage-closer filtering
243226

0 commit comments

Comments
 (0)