【问题标题】:Javascript - Three.js material and shadowJavascript - Three.js 材质和阴影
【发布时间】:2017-03-26 09:39:23
【问题描述】:

我想知道我在选择网状材料时做错了什么。如你所见:

黑色的看起来不错,阴影平滑且正确。但是,如果您注意到,白色的看起来很奇怪,而阴影在我看来并不完美。 (在 HORSE 上非常明显)

我用黑色的-MeshPhongMaterial,白色的-MeshBasicMaterial。如果我尝试将MeshBasicMaterial 更改为MeshPhongMaterialMeshLambertMaterial,就会发生奇怪的事情,我的白色数字变成黑色。

这里是源代码:https://fiddle.jshell.net/m4tv0s3p/

非常相似的问题:ThreeJS shadow not rendering

也许有人可以提出解决方案?或解决方法?

【问题讨论】:

    标签: javascript canvas three.js


    【解决方案1】:

    renderer 你不见了:

    renderer.shadowMapType = THREE.PCFSoftShadowMap;
    

    您应该在light 上添加:

    spotLight.shadowMapWidth = 2048;
    spotLight.shadowMapHeight = 2048;
    

    这些适用于您正在使用的 three.js 版本 (r60),它已经很老了。

    【讨论】:

      猜你喜欢
      • 2016-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-21
      • 1970-01-01
      • 2021-02-12
      • 2020-09-28
      相关资源
      最近更新 更多