Unable to get a DirectionalLight shadow to update correctly

前端 未结 1 584
别那么骄傲
别那么骄傲 2021-01-26 12:02

I have a DirectionalLight in my scene. When I first create the light the shadow covers the intended area. When the viewport is resized (canvas size) I update the sh

1条回答
  •  一整个雨季
    2021-01-26 12:54

    Here is the pattern you need to follow to update a shadow camera on-the-fly:

    light.shadowCameraLeft = -100;
    light.shadowCameraRight = 100;
    
    light.shadowCamera.left = light.shadowCameraLeft;
    light.shadowCamera.right = light.shadowCameraRight;
    
    ...
    
    light.shadowCamera.updateProjectionMatrix();
    

    three.js r.64

    0 讨论(0)
提交回复
热议问题