我想知道是否有任何内置功能可以将相机自动聚焦到three.js中的一个点,从而使环境的其他部分变得相对模糊,就像我们在这些示例中所做的那样?
http://alteredqualia.com/xg/examples/animation_physics_level.htmlhttp://alteredqualia.com/xg/examples/animation_physics_ammo.html
XG库中启用自动对焦的代码如下:
renderer.dofEnabled = false;
renderer.dofAutofocus = true;
renderer.dofAutofocusPoint.set( 0.5, 0.35 );
renderer.dofFocusDistance = 10;
renderer.dofFocusMaxBlur = 0.2;
我不知道XG库的历史,但上面链接中的XG库似乎是基于three.js的,但我们在three.js中没有任何相机自动对焦或dofEnabled。
如果有一些简单的方法可以在three.js中实现它,请告诉我,如果没有,任何关于如何实现它的建议都将不胜感激。
我不知道,但XG库似乎是私有的,代码被混淆了,所以我不知道焦点功能是如何实现的。
我刚刚发现,这种效果被称为"景深"(dof),已经通过使用MeshDepthMaterial实现了,在threejs网站上有一个例子:
http://threejs.org/examples/webgl_postprocessing_dof.html