使用此模块可将实时光照添加到一部分粒子。
This module is part of the Particle System component. When you create a new Particle System GameObject, or add a Particle System component to an exiting GameObject, Unity adds the Lights module to the Particle System. By default, Unity disables this module. To create a new Particle System and enable this module:
Since this module is part of the Particle System component, you access it through the ParticleSystem class. For information on how to access it and change values at runtime, see the Lights module API documentation.
For some properties in this section, you can use different modes to set their value. For information on the modes you can use, see Varying properties over time.
属性 | 功能 |
---|---|
Light | 分配一个光照预制件来描述粒子光照外观。 |
Ratio | 一个介于 0 和 1 之间的值,表示将接受光照的粒子的比例。 |
Random Distribution | 选择是随机分配还是定期分配光照。设置为 true 时,每个粒子都有根据 Ratio 值随机接受光照的机会。较高的值可增加粒子接受光照的概率。设置为 false 时,由 Ratio 控制新创建的粒子接受光照的频率(例如,每第 N 个粒子将接受光照)。 |
Use Particle Color | 设置为 True 时,光照的最终颜色将通过其附加到的粒子的颜色进行调制。如果设置为 False,则使用光照颜色而不进行任何修改。 |
Size Affects Range | 启用此属性后,在光照中指定的__范围 (Range)__ 将受到粒子大小的影响。 |
Alpha Affects Intensity | 启用此属性后,光照的__强度 (Intensity)__ 将受到粒子 Alpha 值的影响。 |
Range Multiplier | 使用此曲线在粒子的生命周期内将一个自定义乘数应用于光照范围。 |
Intensity Multiplier | 使用此曲线在粒子的生命周期内将一个自定义乘数应用于光照强度。 |
Maximum Lights | 使用此设置可避免意外创建大量光照,大量光照可能会使 Editor 无响应或使应用程序运行速度非常慢。 |
Lights 模块是一种为粒子效果添加实时光照的快速方法。此模块可用于使系统将光照投射到周围环境,例如可用于火、烟花或闪电。此外,还可通过该模块让光照从所附着的粒子继承各种属性。这样可以使粒子效果本身的发光更加逼真。例如,为了实现此目的,可使光照随其粒子淡出并使它们共享相同的颜色。
该模块可以非常快速地创建大量实时光照,但实时光照有很高的性能成本,尤其是在前向渲染模式下。如果光照还要投射阴影,性能成本会更高。为了防止意外调整发射速率并因此导致创建数千个实时光照,应使用 Maximum Lights 属性。创建的光照数量超过目标硬件的管理能力可能会导致速度降低和无响应的问题。
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.