|
1 | | -import { FrontSide, BackSide, DoubleSide, NearestFilter, LinearFilter, PCFShadowMap, VSMShadowMap, NoBlending, LessEqualCompare, GreaterEqualCompare, DepthFormat, UnsignedIntType, RGFormat, HalfFloatType, PCFSoftShadowMap } from '../../constants.js'; |
| 1 | +import { FrontSide, BackSide, DoubleSide, NearestFilter, LinearFilter, PCFShadowMap, VSMShadowMap, NoBlending, LessEqualCompare, GreaterEqualCompare, DepthFormat, UnsignedIntType, RGFormat, HalfFloatType, PCFSoftShadowMap, IdentityDepthPacking } from '../../constants.js'; |
2 | 2 | import { WebGLRenderTarget } from '../WebGLRenderTarget.js'; |
3 | 3 | import { WebGLCubeRenderTarget } from '../WebGLCubeRenderTarget.js'; |
4 | 4 | import { MeshDepthMaterial } from '../../materials/MeshDepthMaterial.js'; |
@@ -26,6 +26,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) { |
26 | 26 | _viewport = new Vector4(), |
27 | 27 |
|
28 | 28 | _depthMaterial = new MeshDepthMaterial(), |
| 29 | + _depthMaterialVSM = new MeshDepthMaterial( { depthPacking: IdentityDepthPacking } ), |
29 | 30 | _distanceMaterial = new MeshDistanceMaterial(), |
30 | 31 |
|
31 | 32 | _materialCache = {}, |
@@ -98,11 +99,11 @@ function WebGLShadowMap( renderer, objects, capabilities ) { |
98 | 99 |
|
99 | 100 | if ( _state.buffers.depth.getReversed() === true ) { |
100 | 101 |
|
101 | | - _state.buffers.color.setClear( 1, 1, 1, 1 ); |
| 102 | + _state.buffers.color.setClear( 0, 0, 0, 0 ); |
102 | 103 |
|
103 | 104 | } else { |
104 | 105 |
|
105 | | - _state.buffers.color.setClear( 0, 0, 0, 0 ); |
| 106 | + _state.buffers.color.setClear( 1, 1, 1, 1 ); |
106 | 107 |
|
107 | 108 | } |
108 | 109 |
|
@@ -370,7 +371,15 @@ function WebGLShadowMap( renderer, objects, capabilities ) { |
370 | 371 |
|
371 | 372 | } else { |
372 | 373 |
|
373 | | - result = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial; |
| 374 | + if ( type === VSMShadowMap ) { |
| 375 | + |
| 376 | + result = _depthMaterialVSM; |
| 377 | + |
| 378 | + } else { |
| 379 | + |
| 380 | + result = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial; |
| 381 | + |
| 382 | + } |
374 | 383 |
|
375 | 384 | if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) || |
376 | 385 | ( material.displacementMap && material.displacementScale !== 0 ) || |
|
0 commit comments