gpt4 book ai didi

three.js - 场景中有多个反射器 : How to implement a clone() function?

转载 作者:行者123 更新时间:2023-12-04 08:22:36 25 4
gpt4 key购买 nike

我需要大约 80 个(移动)反射 ShapeBufferGeometry在一个场景中,我希望他们共享尽可能多的 Material 数据。
显然,clone()方法不适用于 Reflector .
我得到了不反射任何东西的黑色几何图形。
尝试添加 clone()方法到 prototype如下,导致根本没有可见的结果:

// Clone function for Reflector
Reflector.prototype.clone = function() {
return new Reflector( this.geometry, this.options );
}

这将如何运作?可以在多个对象之间共享一个反射器吗?
谢谢。

最佳答案

I need about 80 (moving) reflecting ShapeBufferGeometry in a scene and i want them to share as much material data as possible.


请注意 Reflector 的每个实例使用单独的渲染 channel 渲染其环境。我非常怀疑场景中的 80 个反射器是否会产生可用的性能。
此外, Reflector不是为共享 Material 而设计的。一个 clone()不重构 Reflector的实现,方法无法实现. clone()的目的无论如何,方法是有问题的,因为您的场景中只能有少量镜子。所有这些都必须维护唯一的统一数据。渲染器将​​自动确保在具有兼容 Material 设置的 Material 之间共享着色器程序。因此,即使许多对象具有独特的 Material 对象,也不应该有明显的性能下降。

关于three.js - 场景中有多个反射器 : How to implement a clone() function?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65425811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com