创建具有多个粒子大小的 bufferGeometry。最棒的表演?
Create a bufferGeometry with several particles sizes. Best performance?
我创建了一个 THREE.Point 对象,使用 bufferGeometry 来渲染数千个粒子,并且我使用了 PointsMaterial material。我在运行时更新 material,在普通方形粒子(默认粒子)与其他一些纹理和颜色之间切换,效果很好。
当我想创建不同大小的粒子时,问题就来了。我不能只设置一个 BufferAttribute。我尝试制作一个自定义着色器,Three.js Particles of various sizes 但我无法让它工作,可能是一些三版本问题?我不知道。
所以我想按大小对所有粒子进行分组,并为每个粒子大小创建一个 bufferGeometry。但我不确定这是最好的方法。这是性能方面的最佳选择吗?还是我必须创建自定义着色器才能实现此目标?
Three.js revision:72
this answer -- just use the alpha attribute value in the example to vary the point size instead: http://jsfiddle.net/8mrH7/196/
中给出了您想要执行的操作的示例
gl_PointSize = 8.0 * alpha; // use alpha to vary point size, instead
three.js r.73
我创建了一个 THREE.Point 对象,使用 bufferGeometry 来渲染数千个粒子,并且我使用了 PointsMaterial material。我在运行时更新 material,在普通方形粒子(默认粒子)与其他一些纹理和颜色之间切换,效果很好。
当我想创建不同大小的粒子时,问题就来了。我不能只设置一个 BufferAttribute。我尝试制作一个自定义着色器,Three.js Particles of various sizes 但我无法让它工作,可能是一些三版本问题?我不知道。
所以我想按大小对所有粒子进行分组,并为每个粒子大小创建一个 bufferGeometry。但我不确定这是最好的方法。这是性能方面的最佳选择吗?还是我必须创建自定义着色器才能实现此目标?
Three.js revision:72
this answer -- just use the alpha attribute value in the example to vary the point size instead: http://jsfiddle.net/8mrH7/196/
中给出了您想要执行的操作的示例gl_PointSize = 8.0 * alpha; // use alpha to vary point size, instead
three.js r.73