为什么三个js阴影不平滑?

时间:2019-12-15 04:14:26

标签: three.js

我为阴影贴图大小为2048,阴影偏差为-0.0001且阴影类型为PCSoftshadow的定向光设置了阴影,但是渲染的阴影看起来像是低质量,不平滑且不正确(下图)。

enter image description here

如何使阴影更平滑? 这是我的渲染阴影代码

    const dirLight = new THREE.DirectionalLight(0xffffff, 0.75);
    dirLight.color.setHSL(0.1, 1, 0.95);
    dirLight.position.set(-1, 1.75, 1);
    dirLight.position.multiplyScalar(30);
    this.scene.add(dirLight);

    dirLight.castShadow = true;
    dirLight.shadow.mapSize.width = 2048;
    dirLight.shadow.mapSize.height = 2048;

    const d = 80;
    dirLight.shadow.camera.left = -d;
    dirLight.shadow.camera.right = d;
    dirLight.shadow.camera.top = d;
    dirLight.shadow.camera.bottom = -d;
    dirLight.shadow.camera.far = 1000;
    dirLight.shadow.bias = -0.0001;

0 个答案:

没有答案