Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions docs/components/light.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ These global options affect the entire scene, and are set using the `shadow`
system on the `<a-scene>` root element.

```html
<a-scene shadow="type: pcfsoft">
<a-scene shadow="type: pcf">
<!-- ... -->
</a-scene>
```

| 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` |
2 changes: 1 addition & 1 deletion docs/components/shadow.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ for shadows. These are set on `<a-scene>` (e.g., `<a-scene shadow="autoUpdate:
|--------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| enabled | Whether to disable shadows globally, even if there is a shadow component and a light with `castShadow: true` enabled. | true |
| 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 |
| type | Shadow type. One of `pcf`, `basic`, `pcfsoft`. | `pcf` (percentage closer filtering) |
| type | Shadow type. One of `pcf`, `basic`. | `pcf` (percentage closer filtering) |
2 changes: 1 addition & 1 deletion examples/boilerplate/ar-hello-world/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
reflection="directionalLight: a-light[type=directional]"
ar-hit-test="target: #objects;"
renderer="exposure: 1; toneMapping: ACESFilmic"
shadow="type: pcfsoft"
shadow="type: pcf"
xr-mode-ui="XRMode: xr"
>
<a-light type="directional" light="castShadow:true;" position="1 1 1" intensity="1.57" shadow-camera-automatic="#objects"></a-light>
Expand Down
2 changes: 1 addition & 1 deletion examples/boilerplate/webxr-ar-lighting/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<a-assets>
<!-- model by Snooze https://sketchfab.com/3d-models/low-poly-table-b940256ec5994e26a9e71289d1211b19 -->
Expand Down
13 changes: 9 additions & 4 deletions src/systems/shadow.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

/**
Expand All @@ -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 <a-scene shadow="type: pcf">.');
type = 'pcf';
}

sceneEl.renderer.shadowMap.type = SHADOW_MAP_TYPE_MAP[type];
sceneEl.renderer.shadowMap.autoUpdate = data.autoUpdate;
},

Expand Down
Loading