I’m currently working on a large-scale 3D scene using Three.js and have run into performance issues related to rendering shadows. My scene features multiple dynamic light sources and about fifty mesh objects with complex geometries. I’ve noticed that the frame rate drops significantly when shadows are enabled.
Light Types: PointLight and SpotLight
Shadow Map Type: PCFSoftShadowMap
I’ve tried reducing the shadow map resolution and limiting the number of lights casting shadows, but I’m still not achieving the smooth performance I aim for. Below are the settings I’ve tweaked
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap; // default THREE.PCFShadowMap
light.shadow.mapSize.width = 512; // default is 1024
light.shadow.mapSize.height = 512; // default is 1024
Could anyone suggest further optimizations or point out any potential pitfalls in my current setup that might affect performance?
Dimuthu Ruwantha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.