-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Closed
Copy link
Description
Description
Projectorlight is unintentionally illuminating areas behind it, see screenshots
Reproduction steps
- Add a ProjectorLight (angle<90deg)
- Set it facing towards -x;
- You should see the ProjectorLight is illuminating areas behind it (+x)
Code
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
const renderer = new THREE.WebGPURenderer()
const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera(75, 2, 0.1, 100)
const controls = new OrbitControls(camera, renderer.domElement)
scene.background = new THREE.Color('skyblue')
camera.position.set(0, 2, 2)
scene.add(new THREE.AxesHelper())
{ // ground
const geom = new THREE.PlaneGeometry(10, 10).rotateX(Math.PI / -2)
const mat = new THREE.MeshStandardMaterial()
const mesh = new THREE.Mesh(geom, mat)
mesh.position.y = -0.1
scene.add(mesh)
}
{ // light
const light = new THREE.ProjectorLight('white', 10, 2, Math.PI / 10, 0, 2)
light.target = new THREE.Object3D()
light.add(light.target)
light.target.position.set(-1, 0, 0)
light.position.set(0, 0, 0)
scene.add(light)
scene.add(new THREE.SpotLightHelper(light))
}
renderer.setAnimationLoop(() => {
renderer.render(scene, camera)
controls.update()
});
function resize(w, h, dpr = devicePixelRatio) {
renderer.setPixelRatio(dpr)
renderer.setSize(w, h, false)
camera.aspect = w / h
camera.updateProjectionMatrix()
}
addEventListener('resize', () => resize(innerWidth, innerHeight))
dispatchEvent(new Event('resize'))
document.body.prepend(renderer.domElement)
Live example
n/a
Screenshots

Version
dev
Device
No response
Browser
No response
OS
No response