缓冲几何中的补间粒子 [英] tweening particles in buffergeometry

查看:74
本文介绍了缓冲几何中的补间粒子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题附带以下问题:

Three.js-缓冲区几何粒子,需要对系统中的随机粒子组进行动画处理

如何快速更新大型BufferGeometry?

我正在开始一个新项目,该项目随时都会有成千上万的粒子.其概念是,将有看起来像银河系的粒子簇散布在整个场景中.有时我需要为一个星系及其成千上万的粒子设置动画.我可以在几何体仍处于缓冲区内时执行此操作吗?

我正在使用使用 THREE.BufferGeometry 构建的 PointCloud ,每个顶点的位置都使用 Float32Array(numParticles * 3)进行设置./p>

过去,我一直使用 tween.js 为移动的物体设置动画在我的场景中.是否可以提取补间所需的点,转换为vector3,重新定位它们并在每个更新循环上进行渲染?

解决方案

如果要为成千上万的粒子设置动画,请在GPU上执行仿真,然后将粒子的位置放在顶点着色器中.您可以在Google上搜索的流行词是"GPGPU".

您有很多选择:逻辑可以完全在着色器中,和/或可以将更新的控制统一传递给着色器,和/或可以将属性传递给着色器.

这是一个Three.js示例: http://threejs.org/examples/webgl_gpgpu_birds.html

这是一个使用粒子的示例: http://www.neveroccurs.com/lab/three.js/gpu_particles/?particles = 256

three.js r.69

This question piggybacks on the following questions:

Three.js - Buffer geometry particles, need to animate random groups of particles in system

How to quickly update a large BufferGeometry?

I'm starting a new project that will have tens of thousands of particles in the scene at any time. The concept is that there will be clusters of particles that look like galaxies spread throughout the scene. Sometimes I will need animate a galaxy and its thousands of particles. Can I do this while the geometry is still within a buffer?

I'm using a PointCloud constructed using THREE.BufferGeometry, with each vertices position set using Float32Array( numParticles * 3 ).

In the past I've always used tween.js to animate objects moving around in my scenes. Is it possible to extract out the points required for tweening, convert to vector3, reposition them, and render on every update loop?

解决方案

If you want to animate tens of thousands of particles, then perform your simulation on the GPU, and displace the positions of your particles in the vertex shader. The buzzword you can google is "GPGPU".

You have lots of options: the logic can be entirely within the shader, and/or you can pass updated control uniforms to the shader, and/or you can pass attributes to the shader.

Here is a three.js example: http://threejs.org/examples/webgl_gpgpu_birds.html

And here is an example using particles: http://www.neveroccurs.com/lab/three.js/gpu_particles/?particles=256

three.js r.69

这篇关于缓冲几何中的补间粒子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆