【问题标题】:ThreeJS understanding where lights areThreeJS 理解灯光在哪里
【发布时间】:2016-12-07 06:20:21
【问题描述】:

我已经尝试了大约 30 分钟,在我的模型底部放置一个点光源,结果非常糟糕。我不知道我的模型有多少个单位,而且大多数时候我似乎无法在场景中准确定位我的灯光。

我尝试在我的点光源的确切位置添加一个立方体,但以某种方式向我的场景添加另一个几何体破坏了我的主 obj 的纹理更新功能,所以我想这是不可能的。

关于如何精确定位灯光的任何提示?

我的代码在 view-source:http://creativiii.com/3Dproject/

【问题讨论】:

    标签: javascript three.js


    【解决方案1】:

    每个几何图形都有一个boundingSphere 属性,您可以使用它来计算对象的大小。 https://threejs.org/docs/api/core/Geometry.html 如果属性没有值,您可以使用 geometry.computeBoundingSphere(); 计算它

    对于每种灯光类型的灯光,都有一个与之关联的辅助函数,可以显示灯光的位置:

    https://threejs.org/docs/index.html?q=Helper#Reference/Extras.Helpers/HemisphereLightHelper
    https://threejs.org/docs/index.html?q=Helper#Reference/Extras.Helpers/DirectionalLightHelper
    https://threejs.org/docs/index.html?q=Helper#Reference/Extras.Helpers/PointLightHelper
    https://threejs.org/docs/index.html?q=Helper#Reference/Extras.Helpers/SpotLightHelper
    

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-30
      • 2010-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多