光循环一样再现发光光迹的建议

光循环一样再现发光光迹的建议

本文介绍了SceneKit:关于像 Tron 光循环一样再现发光光迹的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标是在 SceneKit 中重现类似于下图的光迹.路径不需要那么详细,但想法是要达到类似的视觉效果.

The goal is to reproduce a light trail similar to the image below in SceneKit. The trail doesn't need to be as detailed, but the idea is to achieve a similar visual effect.

我们尝试使用不透明度约为 0.5 的薄立方体.我们将大约 200 个串在一起,并将它们连接到一个节点上,以充当光迹.那根本没有性能.

We tried using thin cubes with opacity around 0.5. We strung about 200 together and attached them to a node to act as a light trail. That was not performant at all.

另一篇文章建议使用粒子发射器,但我们还需要在另一个物体撞击轨迹时检测碰撞.类文档说粒子发射器的碰撞检测也没有性能.

This other post suggests using particle emitters, but we also need to detect collisions when another object hits the trail. Class documentation says collision detection with particle emitters is also not performant.

关于模拟类似光迹的最佳方法有什么建议吗?

Any suggestions on the best way to do simulate a similar light trail?

一些注意事项:

1) 就像在 Tron 游戏中一样,这些光迹的长度会增加.对于基本边界,假设将有 2000 - 4000 个节点破坏这些光迹(每个玩家大约 200 个).我们可以将 FPS 降至 30 左右.

1) Like in the Tron game, these light trails will grow in length. For basic bounding, assume there will be 2000 - 4000 nodes compromising these light trails (roughly 200 per player). We can drop FPS to around 30.

2) 这些路径是由设计师提供的图像/网格更好地组成还是使用 SCNShapes 构建它们更好?

2) Are these trails better composed with images/meshes from a designer or constructing them out of SCNShapes?

3) 光迹必须能够检测碰撞.

3) The light trails must be capable of detecting collisions.

感谢您的帮助!

推荐答案

粒子可以从几何体及其边界、几何体的顶点或从几何体的整个表面随机发射.这不是一个完整的例子,但这里有一个使用顶点来做到这一点的部分例子:

Particles can be emitted from geometry, with its bounds, from vertices of the geometry or from randomly all over the surface of geometry. It's not a complete example of this, but here's a partial example of using vertices to do that:

来自three.js的示例但是如何使用SceneKit来实现?

因此,您可以动态创建与自行车路径相匹配的几何体,并让它们从顶部和底部边缘发射粒子.但我还没有弄清楚如何让它们以一种指示力/能量/最大轨迹就在自行车后面的方式进行,然后淡出,而不必对物理轨迹几何形状进行复杂的变形...

Because of this, you can create geometry, on the fly, that matches the paths of your bikes, and have them emit particles from their top and bottom edges. But I'm yet to figure out how to make them do so in a way that's indicative of the force/energy/maximum trail being just behind the bike, and then fade out, without having to do complex deformation of a physical trail geometry...

这篇关于SceneKit:关于像 Tron 光循环一样再现发光光迹的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 00:11