You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello - odd behavior I'm noticing, weirdly shadows will work (in browsers where shadows are not working) if an object is placed above the light
As you can see on the threejs examples page, this is what I see (no shadows) across specific browsers / environments:
Below what is shown (and referenced jsfiddle below), is that shadows appear to work when a mesh is placed close above the light, but doesn't work when there is nothing above the light:
No mesh above light:
Mesh above light:
Environments where shadows work completely fine, without needing box above light:
Windows 11 (Arc Browser)
Mac M1 Max (Brave Dev)
Environments where shadows are not working, but works with box above light:
Windows 11 (Chrome)
Mac M1 Max (Arc Browser)
Mac M1 Max (Chrome)
Reproduction steps
Please see description
Code
import*asTHREEfrom"three"import{OrbitControls}from"three/addons/controls/OrbitControls.js"letrenderer,scene,camera,controls;init()functioninit(){scene=newTHREE.Scene()camera=newTHREE.PerspectiveCamera(45,window.innerWidth/(window.innerHeight/2),0.1,1000,)camera.position.set(10,10,10)renderer=newTHREE.WebGPURenderer()renderer.setPixelRatio(window.devicePixelRatio)renderer.setSize(window.innerWidth,window.innerHeight)renderer.setAnimationLoop(animate)renderer.shadowMap.enabled=truedocument.body.appendChild(renderer.domElement)controls=newOrbitControls(camera,renderer.domElement)constgeometry=newTHREE.SphereGeometry(1,128,128)constnodeMaterial=newTHREE.MeshPhysicalNodeMaterial();constshape=newTHREE.Mesh(geometry,nodeMaterial)shape.position.set(1,3,5)shape.castShadow=trueshape.receiveShadow=truescene.add(shape)constshape2=newTHREE.Mesh(newTHREE.BoxGeometry(100,0.1,100),nodeMaterial)shape2.castShadow=trueshape2.receiveShadow=truescene.add(shape2)constshape3=newTHREE.Mesh(newTHREE.BoxGeometry(100,0.1,100),nodeMaterial)shape3.position.set(1,10,5)shape3.castShadow=trueshape3.receiveShadow=true// SHADOWS ONLY WORKING IF OBJECT PLACED ABOVE LIGHT - COMMENT UNCOMMENT BELOW LINE/* scene.add(shape3) */constlight=newTHREE.PointLight(0xffffff,25,100)light.position.set(1,5,1)light.castShadow=truelight.shadow.mapSize.width=1024;light.shadow.mapSize.height=1024;light.shadow.radius=10;scene.add(light)}functionanimate(){controls.update()renderer.render(scene,camera)}
Description
Hello - odd behavior I'm noticing, weirdly shadows will work (in browsers where shadows are not working) if an object is placed above the light
As you can see on the threejs examples page, this is what I see (no shadows) across specific browsers / environments:
Below what is shown (and referenced jsfiddle below), is that shadows appear to work when a mesh is placed close above the light, but doesn't work when there is nothing above the light:
No mesh above light:
Mesh above light:
Environments where shadows work completely fine, without needing box above light:
Windows 11 (Arc Browser)
Mac M1 Max (Brave Dev)
Environments where shadows are not working, but works with box above light:
Windows 11 (Chrome)
Mac M1 Max (Arc Browser)
Mac M1 Max (Chrome)
Reproduction steps
Please see description
Code
Live example
https://jsfiddle.net/illestrater/2ehtnxqo/78/
Screenshots
No response
Version
r172
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: