Lights are easy to use in Unity - you need to create a light of the desired type (for example, from the menu GameObject > Light > Point Light) and place it where you want it in the scene. If you enable scene view lighting (the “lightbulb” button on the toolbar) then you can see a preview of how the lighting will look as you move light objects and set their parameters.
A directional light can be placed anywhere in the scene (unless it’s using a Cookie) with the forward/Z axis indicating the direction. A Spot Light also has a direction but since it has a limited range, its position does matter. The shape parameters of spot, point, and area lights can be adjusted from the inspector or by using the lights’ Gizmos directly in the scene view.
方向光通常代表太阳并且对场景的外观具有显著影响。光线方向应略微向下,但您通常需要确保光线与场景中的主要对象形成一个小角度。例如,对于一个大致形状为立方体的对象,如果光线未正面照射立方体的任何一面,该立方体的着色将更有趣并会在 3D 模式下显得“突出”得多。
聚光灯和点光源通常代表人造光源,因此它们的位置通常由场景对象决定。这些光源的一个常见疑惑是,当您第一次将它们添加到场景时,它们似乎根本没有任何效果。当您调整光源的作用范围以便适应场景要求时,便会发生这种情况。光源的作用范围是光的亮度变暗为零的界限。比如说,如果设置一个聚光灯,使锥体的底部恰好落在地板上,那么除非另一个对象从该光源下面通过,否则几乎没有任何效果。如果您希望关卡几何体接受光照,则应扩展点光源和聚光灯,使它们穿过墙壁和地板。
光源的颜色和强度(亮度)是可从检视面板中设置的属性。默认的强度和白色适用于为对象着色的“普通”光照,但您可能希望改变属性以便产生特殊效果。例如,一个发光的绿色力场可能足够亮到在强烈的绿光下沐浴周围的对象;汽车前照灯(特别是在旧车上)通常具有淡黄色而不是亮白色的灯光。这些效果最常用于点光源和聚光灯,但在某些情况下,比如说,如果游戏背景是有红色太阳的遥远星球,则可能也需要改变方向光的颜色。
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.