三.js rectAreaLight 最新

Posted

技术标签:

【中文标题】三.js rectAreaLight 最新【英文标题】:three.js rectAreaLight up to date 【发布时间】:2018-06-14 19:28:48 【问题描述】:

所以这放弃了? three.js 的特性似乎已成为某种圣杯;我尝试了几次都没有成功。

处理旧版本的示例在这里:https://threejs.org/examples/#webgl_lights_rectarealight

我的最小损坏示例在这里: https://jsfiddle.net/bitsofcoad/1k3arL33/

var width = 20;
var height = 20;
var rectLight = new THREE.RectAreaLight( 0xffffff, 500,  width, height );
rectLight.intensity = 500.0;
rectLight.position.set( 0, 30, 0 );
rectLight.lookAt( mesh2.position );
scene.add( rectLight )

var rectLightHelper = new THREE.RectAreaLightHelper( rectLight );
scene.add( rectLightHelper );

我已确保在 jsfiddle 中包含正确的rectarealight 库。

这个帖子对为什么这个 PR 有一些困难的话题特别有启发性: https://github.com/mrdoob/three.js/pull/9234

这个帖子很有趣,看看其他人在为 three.js 开发类似类型的灯光方面取得了多大进展:

Improved Area Lighting in WebGL & ThreeJS

我真的不知道打破 abelnation 的例子发生了什么,或者即使它完全被打破(我可能搞砸了我的 jsfiddle...),但我认为这个功能仍然有相当大的兴趣。

柔和的边缘看起来很漂亮,我很想蚕食 WestLangley 的自定义着色器 (http://jsfiddle.net/hh74z2ft/89/),它几乎具有我需要的所有功能。

还有其他人能够使基本功能正常工作吗?谢谢!

【问题讨论】:

current dev branch example 为标准材料工作(对我来说),不再对 phong 工作(或者它从来没有工作过?)。我的引擎中没有 fps 来处理标准材质,但无论如何感谢您为我指明了正确的方向! 您的 ``RectAreaLight` 包含文件来自不同的 three.js 修订版。 jsfiddle.net/1k3arL33/1 【参考方案1】:

MeshStandardMaterialMeshPhysicalMaterial 都支持区域灯。其他材料没有。

three.js r.89

【讨论】:

以上是关于三.js rectAreaLight 最新的主要内容,如果未能解决你的问题,请参考以下文章