optimizationthree.jsshadowshadow-mapping

Three js - Different shadow maps for different lights


I have a three js scene with two lights. I want light A to use PCFShadowMap and light B to use BasicShadowMap. How to achieve that?

My main concern is performance. I am looking for a way to cast different quality shadows from different light sources.


Solution

  • I want light A to use PCFShadowMap and light B to use BasicShadowMap. How to achieve that?

    This is not possible. The type of shadow maps can only be configured globally on renderer level:

    renderer.shadowMap.type = THREE.PCFShadowMap;
    

    If you are concerned about performance, consider to lower the resolution of shadow maps which you can configure per light.

    light.shadow.mapSize.width = 256;
    light.shadow.mapSize.height = 256;