Lights 灯光(光源)

优质
小牛编辑
121浏览
2023-12-01

Lights are an essential part of every scene. While meshes and textures define the shape and look of a scene, lights define the color and mood of your 3D environment. You'll likely work with more than one light in each scene. Making them work together requires a little practice but the results can be quite amazing.

光源是每一个场景的重要组成部分。网格和纹理决定了场景的形状和外观,光源则决定你的3D环境的颜色和氛围。你可能在每个场景中使用一个以上的光源,让它们一起工作需要一些实践,但其结果是相当惊人的。

Lights(光源)

A simple, two-light setup 一个简单的、两个光源的设置

Lights can be added to your scene from the GameObject->Create Other menu. There are three types of lights which we'll discuss in a moment. Once a light has been added, you can manipulate it like any other GameObject. Additionally, you can add a Light Component to any selected GameObject by using Component->Rendering->Light.

通过菜单GameObject->Create Other可以为你的场景添加光源。有三种类型的光源,我们将在稍后讨论。一旦添加了光源,你可以像操纵其他游戏对象那样来操纵它。此外,你可以通过Component->Rendering->Light为选定的游戏对象添加一个光源组件。

There are many different options within the Light Component in the Inspector.

在检视视图中光源组件有许多不同的选项。

检视视图中光源组件的属性

Light Component properties in the Inspector 检视视图中光源组件的属性

By simply changing the Color of a light, you can give a whole different mood to the scene.

通过简单地改变光源的颜色,你可以给场景一个完全不同的氛围。

明亮的、温暖的光

Bright, sunny lights 明亮的、温暖的光

黑暗的、中世纪的光

Dark, medieval lights 黑暗的、中世纪的光

幽灵般的、夜晚的光

Spooky night lights 幽灵般的、夜晚的光

The lights you create this way are realtime lights - their lighting is calculated each frame while the game is running. If you know the light will not change, you can make your game faster and look much better by using Lightmapping.

这种方式创建的光源是实时光源——它们在游戏运行的每一帧都要进行计算。如果你知道某个地方的光照是不变的,可以使用光照贴图让你的游戏速度更快,看起来更好。

Rendering paths 渲染路径

Unity supports different Rendering Paths, these paths affect mainly Lights and Shadows, so choosing the correct rendering path depending on your game requirements can improve your project's performance. For more info about rendering paths you can visit the Rendering paths section.

Unity支持不同的渲染路径,这些路径主要影响光与影,因此选择正确的渲染路径取决于你的游戏中可以改善项目性能的那些条件。了解更多渲染路径的信息你可以访问Rendering paths

More information 更多信息

For more information about using Lights, check the Lights page in the Reference Manual.

如需使用光源的更多信息,请查看Reference Manual中的Lights page。