diff --git a/CHANGELOG.md b/CHANGELOG.md index b7572f0a241..cee8973ea2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Deprecations - If you used material `npot: true` previously as a way to set `texture.minFilter = THREE.LinearFilter` for better image quality, you need to replace it with `minFilter: linear`. That change was introduced in #5717 that removed `npot` property that was legacy of WebGL1, new material properties `minFilter` and `magFilter` have been exposed instead. +- If you used `shadow="type: pcfsoft"`, change it to `shadow="type: pcf"`. From three.js migration guide for r182: PCFSoftShadowMap with WebGLRenderer is now deprecated. Use PCFShadowMap which is now soft as well. ### 1.7.1 (Apr 1, 2025) diff --git a/docs/components/light.md b/docs/components/light.md index 1d3a4112e06..d2fedb13fda 100644 --- a/docs/components/light.md +++ b/docs/components/light.md @@ -267,11 +267,11 @@ These global options affect the entire scene, and are set using the `shadow` system on the `` root element. ```html - + ``` | Property | Description | Default Value | |--------------------|---------------------------------------------------------------------------------------------------------------|---------------| -| type | Defines shadow map type (`basic`, `pcf`, `pcfsoft`) with varying appearance and performance characteristics. | `pcf` | +| type | Defines shadow map type (`basic`, `pcf`) with varying appearance and performance characteristics. | `pcf` | diff --git a/docs/components/shadow.md b/docs/components/shadow.md index 9ad75be0fd0..1f0bbf7d938 100644 --- a/docs/components/shadow.md +++ b/docs/components/shadow.md @@ -47,4 +47,4 @@ for shadows. These are set on `` (e.g., ` diff --git a/examples/boilerplate/webxr-ar-lighting/index.html b/examples/boilerplate/webxr-ar-lighting/index.html index 7127e6c16c4..132c1ec0d58 100644 --- a/examples/boilerplate/webxr-ar-lighting/index.html +++ b/examples/boilerplate/webxr-ar-lighting/index.html @@ -18,7 +18,7 @@ background="color:skyblue;" reflection="directionalLight:#dirlight;" ar-hit-test="target:#table;" - shadow="type: pcfsoft" + shadow="type: pcf" xr-mode-ui="XRMode: xr"> diff --git a/src/systems/shadow.js b/src/systems/shadow.js index 10c2d906434..769af84e4c2 100644 --- a/src/systems/shadow.js +++ b/src/systems/shadow.js @@ -3,8 +3,7 @@ import { registerSystem } from '../core/system.js'; var SHADOW_MAP_TYPE_MAP = { basic: THREE.BasicShadowMap, - pcf: THREE.PCFShadowMap, - pcfsoft: THREE.PCFSoftShadowMap + pcf: THREE.PCFShadowMap }; /** @@ -17,16 +16,22 @@ export var System = registerSystem('shadow', { schema: { enabled: {default: true}, autoUpdate: {default: true}, - type: {default: 'pcf', oneOf: ['basic', 'pcf', 'pcfsoft']} + type: {default: 'pcf', oneOf: ['basic', 'pcf']} }, init: function () { var sceneEl = this.sceneEl; var data = this.data; + var type = data.type; this.shadowMapEnabled = false; - sceneEl.renderer.shadowMap.type = SHADOW_MAP_TYPE_MAP[data.type]; + if (SHADOW_MAP_TYPE_MAP[type] === undefined) { + console.warn('shadow type "' + type + '" is not supported, falling back to "pcf". To remove this warning set .'); + type = 'pcf'; + } + + sceneEl.renderer.shadowMap.type = SHADOW_MAP_TYPE_MAP[type]; sceneEl.renderer.shadowMap.autoUpdate = data.autoUpdate; },