Lens Flare 镜头光晕

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

Lens Flares simulate the effect of lights refracting inside camera lens. They are used to represent really bright lights or, more subtly, just to add a bit more atmosphere to your scene.

镜头光晕 模拟相机镜头内的折射光线的效果。它们被用来代表真正的明亮的灯光,更微妙的是,可以在你的场景添加多一点的气氛。

Lens Flare 镜头光晕
The Lens Flare Inspector 镜头光晕(Lens Flare)检视窗口

The easiest way to setup a Lens Flare is just to assign the Flare property of the Light. Unity contains a couple of pre-configured Flares in the Standard Assets package.

建立镜头光晕 最简单的方法 是 指定光线(Light)的光晕属性( Flare property)。Unity在Standard Assets package.包含了一些预设的光晕(Flares)资源。

Otherwise, create an empty GameObject with GameObject->Create Empty from the menu bar and add the Lens Flare Component to it with Component->Rendering->Lens Flare. Then and choose the Flare in the Inspector.

否则,按照以下步骤: 1. 从菜单栏依次 GameObject - >Create Empty  来创建一个空的游戏对像(GameObject) 2. 再Component->Rendering->Lens Flare 给这个空的游戏对象(GameObject)添加 镜头光晕组件(Lens Flare Component) 3.最后在检视面板选择光晕(Flare)

To see the effect of Lens Flare in the Scene View, check the Fx button in the Scene View toolbar:

想要在场景视图中看到镜头光晕的效果,选上场景视图工具栏中的Fx按钮。

Lens Flare 镜头光晕
Enable the Fx button to view Lens Flares in the Scene View
选上Fx 按钮才能看到场景视图上的镜头光晕(Lens Flares)效果。

Properties 属性

  • Flare 光晕 The Flare to render. The flare defines all aspects of the lens flare's appearance.
    要渲染的光晕(Flare ),光晕定义了镜头光晕外观的所有方面。
  • Color 颜色 Some flares can be colorized to better fit in with your scene's mood.
    一些光晕可以填上颜色以更加适合你场景的风格。
  • Brightness 亮度 How large and bright the Lens Flare is.
    镜头光晕(Lens Flare)的大小和明亮程度。
  • Directional 方向 If set, the flare will be oriented along positive Z axis of the game object. It will appear as if it was infinitely far away, and won't track object's position, only the direction of Z axis.
    如果设置了,光晕将以游戏对象的Z轴为方向。它会看上去好像是无限远,而且不会跟踪对象的位置,只沿着Z轴作为方向。

Details 详情

You can directly set flares as a property of a Light Component, or set them up separately as Lens Flare component. If you attach them to a light, they will automatically track the position and direction of the light. To get more precise control, use this Component.

你可以直接将光晕设置为光线组件( Light Component)的属性,或者独立地在镜头光晕组件(Lens Flare component.)建立他们。如果你把它们贴在一个光线上,他们会自动跟踪光线的位置和方向。使用这个组件,得到更精确的控制 。

A Camera has to have a Flare Layer Component attached to make Flares visible (this is true by default, so you don't have to do any set-up).

相机(Camera )贴有光晕层组件(Flare Layer Component) 使光晕可见(这是真的,默认情况下,因此你不需要做任何设置)。

Hints 提示

  • Be discrete about your usage of Lens Flares. 使用镜头光晕应分散(Lens Flares)。(即不要都叠在一起)
  • If you use a very bright Lens Flare, make sure its direction fits with your scene's primary light source.
    如果你用的是一个很明亮的镜头光晕(Lens Flare),保证它的方向与你的场景主要光源的方向相符合
  • To design your own Flares, you need to create some Flare Assets. Start by duplicating some of the ones we provided in the the Lens Flares folder of the Standard Assets, then modify from that.
    你自己的光晕时,你需要创建一些光晕的资源。通过复制一些在Standard Assets的文件夹中提供的镜头光晕(Lens Flares)的开始,然后修改。
  • Lens Flares are blocked by Colliders. A Collider in-between the Flare GameObject and the Camera will hide the Flare, even if the Collider does not have a Mesh Renderer.
    镜头光晕会被碰撞器遮挡。一个介于光晕游戏对象 (Flare GameObject)和相机之间的碰撞器会把光晕隐藏掉(即使碰撞器没有Mesh Renderer)。