Skip to content

Commit 5b52a29

Browse files
committed
Remove pcfsoft shadow type, deprecated in r182, pcf is now soft as well, show a warning about shadow type not supported and fall back to pcf
1 parent 64dff3e commit 5b52a29

6 files changed

Lines changed: 15 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
### Deprecations
44

55
- 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.
6+
- 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.
67

78
### 1.7.1 (Apr 1, 2025)
89

docs/components/light.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ These global options affect the entire scene, and are set using the `shadow`
267267
system on the `<a-scene>` root element.
268268

269269
```html
270-
<a-scene shadow="type: pcfsoft">
270+
<a-scene shadow="type: pcf">
271271
<!-- ... -->
272272
</a-scene>
273273
```
274274

275275
| Property | Description | Default Value |
276276
|--------------------|---------------------------------------------------------------------------------------------------------------|---------------|
277-
| type | Defines shadow map type (`basic`, `pcf`, `pcfsoft`) with varying appearance and performance characteristics. | `pcf` |
277+
| type | Defines shadow map type (`basic`, `pcf`) with varying appearance and performance characteristics. | `pcf` |

docs/components/shadow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ for shadows. These are set on `<a-scene>` (e.g., `<a-scene shadow="autoUpdate:
4747
|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
4848
| enabled | Whether to disable shadows globally, even if there is a shadow component and a light with `castShadow: true` enabled. | true |
4949
| autoUpdate | Whether to dynamically update the shadow map every frame. Disable and manually update by setting `renderer.shadowMap.needsUpdate = true` for best performance. Calculating shadow maps is expensive. | true |
50-
| type | Shadow type. One of `pcf`, `basic`, `pcfsoft`. | `pcf` (percentage closer filtering) |
50+
| type | Shadow type. One of `pcf`, `basic`. | `pcf` (percentage closer filtering) |

examples/boilerplate/ar-hello-world/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
reflection="directionalLight: a-light[type=directional]"
2424
ar-hit-test="target: #objects;"
2525
renderer="exposure: 1; toneMapping: ACESFilmic"
26-
shadow="type: pcfsoft"
26+
shadow="type: pcf"
2727
xr-mode-ui="XRMode: xr"
2828
>
2929
<a-light type="directional" light="castShadow:true;" position="1 1 1" intensity="1.57" shadow-camera-automatic="#objects"></a-light>

examples/boilerplate/webxr-ar-lighting/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
background="color:skyblue;"
1919
reflection="directionalLight:#dirlight;"
2020
ar-hit-test="target:#table;"
21-
shadow="type: pcfsoft"
21+
shadow="type: pcf"
2222
xr-mode-ui="XRMode: xr">
2323
<a-assets>
2424
<!-- model by Snooze https://sketchfab.com/3d-models/low-poly-table-b940256ec5994e26a9e71289d1211b19 -->

src/systems/shadow.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import { registerSystem } from '../core/system.js';
33

44
var SHADOW_MAP_TYPE_MAP = {
55
basic: THREE.BasicShadowMap,
6-
pcf: THREE.PCFShadowMap,
7-
pcfsoft: THREE.PCFSoftShadowMap
6+
pcf: THREE.PCFShadowMap
87
};
98

109
/**
@@ -17,16 +16,22 @@ export var System = registerSystem('shadow', {
1716
schema: {
1817
enabled: {default: true},
1918
autoUpdate: {default: true},
20-
type: {default: 'pcf', oneOf: ['basic', 'pcf', 'pcfsoft']}
19+
type: {default: 'pcf', oneOf: ['basic', 'pcf']}
2120
},
2221

2322
init: function () {
2423
var sceneEl = this.sceneEl;
2524
var data = this.data;
25+
var type = data.type;
2626

2727
this.shadowMapEnabled = false;
2828

29-
sceneEl.renderer.shadowMap.type = SHADOW_MAP_TYPE_MAP[data.type];
29+
if (SHADOW_MAP_TYPE_MAP[type] === undefined) {
30+
console.warn('shadow type "' + type + '" is not supported, falling back to "pcf". To remove this warning set <a-scene shadow="type: pcf">.');
31+
type = 'pcf';
32+
}
33+
34+
sceneEl.renderer.shadowMap.type = SHADOW_MAP_TYPE_MAP[type];
3035
sceneEl.renderer.shadowMap.autoUpdate = data.autoUpdate;
3136
},
3237

0 commit comments

Comments
 (0)