根据项目使用的渲染管线,Unity 在 Light Inspector 中显示不同的属性。
属性: | 功能: |
---|---|
Type | 当前的光源类型。可选值为 Directional、Point、Spot 和 Area。有关这些值的信息,请参阅光源类型。 |
Range | 定义从对象中心发出的光线的行进距离(仅限点光源和聚光灯)。 |
Spot Angle | 定义聚光灯锥形底部的角度(以度为单位)(仅限聚光灯)。 |
Color | 使用拾色器来设置发光的颜色。 |
Mode | 指定光源模式。可选模式为 Realtime、Mixed 和 Baked。有关这些值的信息,请参阅光源模式。 |
Intensity | 设置光源的亮度。方向光的默认值为 0.5。点光源、聚光灯或面光源的默认值为 1。 |
Indirect Multiplier | 使用此值可改变间接光的强度。如果将 Indirect Multiplier 设置为低于 1 的值,每次反弹都会使散射光变得更暗。大于 1 的值使光线在每次弹射之后更明亮。例如,将阴暗处的阴暗面(例如洞穴内部)变亮到能够清晰可见,这个非常有用。如果要使用实时全局光照,但是希望限制单一实时光源以便它只发出直射光,请将其 Indirect Multiplier 设置为 0。 |
属性: | 功能: |
---|---|
Shadow Type | 决定此光源投射生硬阴影、柔和阴影还是根本不投射阴影。生硬阴影 (Hard Shadows) 会产生锐边的阴影。与柔和阴影 (Soft Shadows) 相比,生硬阴影 (Hard Shadows) 不是特别逼真,但涉及的处理工作较少,并且在许多使用场合中是可接受的。此外,柔和阴影 (Soft Shadows) 往往还会减少阴影贴图中的“块状”锯齿效果。 |
Baked Shadow Angle | 如果 Mode 设置为 Baked 或 Mixed,Type 设置为 Directional,且 Shadow Type 设置为 Soft Shadows,此属性将为阴影边缘添加一些人工柔化,使其看起来更自然。 |
Baked Shadow Radius | 如果 Mode 设置为 Baked 或 Mixed,Type 设置为 Point 或 Spot,且 Shadow Type 设置为 Soft Shadows,此属性将为阴影边缘添加一些人工柔化,使其看起来更自然。 |
Realtime Shadows | 这些属性在 Mode 设置为 Realtime 或 Mixed 且 Shadow Type 设置为 Hard Shadows 或 Soft Shadows 时可用。使用这些属性可控制实时阴影渲染设置。 |
Strength | 使用滑动条来控制此光源所投射阴影的暗度(以 0 和 1 之间的值表示)。默认情况下,此值设置为 1。 |
Resolution | 控制阴影贴图的渲染分辨率。较高的分辨率会增加阴影的保真度,但需要更多的 GPU 时间和内存使用量。 |
Bias | 使用滑动条来控制阴影被推离光源的距离(定义为 0 到 2 之间的值)。这可用于避免错误的自阴影瑕疵。请参阅阴影贴图和 Bias 属性以了解更多信息。默认情况下,该值设置为 0.05。 |
Normal Bias | 使用滑动条来控制阴影投射面沿着表面法线收缩的距离(定义为 0 到 3 之间的值)。这可用于避免错误的自阴影瑕疵。请参阅关于阴影贴图和 Bias 属性的文档以了解更多信息。默认情况下,该值设置为 0.4。 |
Near Plane | 使用滑动条来控制渲染阴影时近裁剪面的值,定义为介于 0.1 和 10 之间的值。此值被限制为光源的 Range 属性的 0.1 个单位或 1%(以较低者为准)。默认情况下,该值设置为 0.2。 |
属性: | 功能: |
---|---|
Cookie | 指定用于投射阴影的纹理遮罩(例如,为光源创建轮廓或图案光照)。 |
Draw Halo | 勾选此框可绘制直径等于 Range 值的光源的球形光环 (Halo)。您还可以使用 Halo 组件来实现此效果。请注意,除了光源 (Light) 组件中的光环外,还绘制 Halo 组件,并且 Halo 组件的 Size 参数将确定其半径,而不是直径。 |
Flare | 如果要设置光晕在光源位置渲染,请将资源置于此字段中以用作其源。 |
Render Mode | 使用此下拉选单来设置所选光源的渲染优先级。这会影响光照保真度和性能。 |
Auto | 在运行时确定渲染方法,具体取决于附近光源的亮度和当前的 Quality 设置。 |
Important | 光源始终以像素质量为单位进行渲染。Important 模式仅用于最显著的视觉效果(例如,玩家汽车的前照灯)。 |
Not Important | 光源以快速、顶点/对象模式进行渲染。 |
Culling Mask | 使用此属性可选择性排除对象组,使其不受光源影响。有关更多信息,请参阅层。 |
如果创建包含 Alpha 通道的纹理并将其分配给光源的 Cookie 变量,则会从光源投射剪影。剪影的 Alpha 遮罩会调制光源亮度,从而在表面上产生亮点和暗点。是为场景增加复杂性或氛围的好方法。
顶点光照 (VertexLit) 着色器无法显示剪影或阴影。
请注意,使用前向渲染时,会对带有剪影的方向光禁用阴影。在此情况下,可以编写自定义着色器来启用阴影;请参阅关于编写表面着色器的文档以了解更多详细信息。
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.