为了在创作粒子系统时提供灵活性,Unity 提供两种解决方案来供您选择。如果项目的目标平台支持计算着色器,Unity 允许同时使用这两种解决方案。这两种粒子系统解决方案为:
下表显示了两种粒子系统解决方案的概要对比情况。有关任一解决方案的更多信息,请参阅内置粒子系统或 Visual Effect Graph。
功能 | 内置粒子系统 | Visual Effect Graph |
---|---|---|
渲染管线兼容性 | Built-in Render Pipeline, Universal Render Pipeline, High Definition Render Pipeline | Universal Render Pipeline, High Definition Render Pipeline |
可实现的粒子数 | 数千 | 数百万 |
粒子系统创作 | 简单模块创作过程,使用 Inspector 中的粒子系统 (Particle System) 组件。每个模块代表粒子的一种预定义行为。 | 可高度定制的创作过程,使用图形视图。 |
物理 | 粒子可与 Unity 的基础物理系统进行交互。 | 粒子可与 Visual Effect Graph 中定义的特定元素进行交互。例如,粒子可与深度缓冲区进行交互。 |
脚本交互 | 可以使用 C# 脚本在运行时对粒子系统进行全面自定义。可以对系统中的每个粒子进行读取和写入操作,还可以响应碰撞事件。粒子系统组件还提供播放控制 API。这意味着可以使用脚本来播放和暂停粒子效果,并使用自定义步长来模拟粒子效果。 | 可以公开图形属性,并通过 C# 脚本访问这些属性,从而对效果实例进行自定义。还可以使用事件接口来发送自定义事件以及可由图形处理的附加数据。视觉效果 (Visual Effect) 组件还提供播放控制 API。这意味着可以使用脚本来播放和暂停粒子效果,并使用自定义步长来模拟粒子效果。 |
帧缓冲区 | 无 | 在高清渲染管线中,提供对颜色和深度缓冲区的访问权。例如,可以对颜色缓冲区进行采样并使用结果来设置粒子颜色,也可以使用深度缓冲区来模拟碰撞。 |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.