Flare 眩光 耀斑

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

Flare objects are the source assets that are used by Lens Flare Components. The Flare itself is a combination of a texture file and specific information that determines how the Flare behaves. Then when you want to use the Flare in a Scene, you reference the specific Flare from inside a LensFlare Component attached to a GameObject.

眩光(Flare )对象是被镜头光晕组件( Lens Flare Components)使用的源资源。眩光本身是一个纹理文件和具体的信息的结合,确定眩光的行为。然后,当你想在一个场景中使用眩光,将带有镜头晕光组件(LensFlare Component)的具体眩光贴到一个游戏物体。

There are some sample Flares in the Standard Assets package. If you want to add one of these to your scene, attach a Lens Flare Component to a GameObject, and drag the Flare you want to use into the Flare property of the Lens Flare, just like assigning a Material to a Mesh Renderer.

在标准资源包(Standard Assets package)中有一些样品耀斑。如果您要添加其中之一到你的场景,将镜头光晕(Lens Flare)组件贴到一个游戏物体上,并拖动你要使用到镜头光晕的耀斑属性的耀斑,就像给网格渲染器( Mesh Renderer)指派一个材质(Material )一样。

耀斑检视面板
The Flare Inspector 耀斑检视面板

Flares work by containing several Flare Elements on a single Texture. Within the Flare, you pick & choose which Elements you want to include from any of the Textures.

耀斑在一个纹理中包含几个耀斑元素(Elements )。你可以挑选和选择要包含纹理的哪些元素。

Properties 属性

  • Elements 元素 The number of Flare images included in the Flare.
    包括在耀斑中的耀斑图像的数量
  • Image Index
    图像索引 Which Flare image to use from the Flare Texture for this Element. See the Flare Textures section below for more information.
    该元素的耀斑纹理( Flare Texture )使用哪一个耀斑图像。耀斑纹理(Flare Textures )更多信息,见下面一节。
  • Position 位置 The Element's offset along a line running from the containing GameObject's position through the screen center. 0 = GameObject position, 1 = screen center.
    包含游戏物体的位置到屏幕中心位置上的元素偏移量。 0 =游戏物体的位置,1=屏幕的中心。
  • Size 大小 The size of the element. 元素的大小
  • Color 颜色 Color tint of the element. 元素的色调
  • Use Light Color 使用光颜色 If the Flare is attached to a Light, enabling this will tint the Flare with the Light's color.
    如果耀斑贴到到一个灯光上,启用它为耀斑填上光的颜色。
  • Rotate 旋转 If enabled, bottom of the Element will always face the center of the screen, making the Element spin as the Lens Flare moves around on the screen.
    如果启用,元素底部将始终面对着屏幕的中心,使元素旋转同时镜头光晕在屏幕上移动。
  • Zoom 变焦 If enabled, the Element will scale up when it becomes visible and scale down again when it isn't.
    如果启用,元素当它可见时变大和当它不可见时缩小。
  • Fade 淡出 If enabled, the Element will fade in to full strength when it becomes visible and fade out when it isn't.
    如果启用,元素当它可见时淡入大和当它不可见时淡出。
  • Flare Texture
    耀斑纹理 A texture containing images used by this Flare's Elements. It must be arranged according to one of the TextureLayout options.
    包含用于耀斑元素的图像的纹理。必须安排的纹理布局(TextureLayout )选项之一。
  • Texture Layout
    纹理布局 How the individual Flare Element images are laid out inside the Flare Texture.
    单个耀斑元素的图像在耀斑纹理内部如何布局。
  • Use Fog 使用雾 If enabled, the Flare will fade away with distance fog. This is used commonly for small Flares.
    如果启用,耀斑将随着远处雾淡出。常用于小耀斑。

Details 细节

A Flare consists of multiple Elements, arranged along a line. The line is calculated by comparing the position of the GameObject containing the Lens Flare to the center of the screen. The line extends beyond the containing GameObject and the screen center. All Flare Elements are strung out on this line.

耀斑由沿直线排列的多个元素(Elements)组成。这条线是通过比较包含镜头光晕游戏物体的位置到屏幕中心的位置计算。这条线穿过包含的游戏物体和屏幕的中心进行延伸。所有耀斑元素在这条线上串起。

Flare Textures 耀斑纹理

For performance reasons, all Elements of one Flare must share the same Texture. This Texture contains a collection of the different images that are available as Elements in a single Flare. The Texture Layout defines how the Elements are laid out in the Flare Texture.

出于性能方面的原因,耀斑的所有元素都必须共享相同的纹理。这纹理包含可作为在一个单一耀斑元素的不同图像的集合。纹理布局( Texture Layout )决定了元素(Elements )是如何在耀斑纹理(Flare Texture)进行布局。

Texture Layouts 纹理布局

These are the options you have for different Flare Texture Layouts. The numbers in the images correspond to the Image Index property for each Element.

这些决定不同的耀斑纹理布局(Texture Layouts.)的选项。在图像中的数字对应每个元素的图像索引属性。

  • 1 Large 4 Small
    1大4小 1大4小
    Designed for large sun-style Flares where you need one of the Elements to have a higher fidelity than the others. This is designed to be used with Textures that are twice as high as they are wide.
    设计用于较大太阳类型的耀斑,需要有比其他更高清晰度的元素。使用的纹理高是宽的2两倍。
  • 1 Large 2 Medium 8 Small
    1大2中8小 1大2中8小
    Designed for complex flares that require 1 high-definition, 2 medium & 8 small images. This is used in the standard assets "50mm Zoom Flare" where the two medium Elements are the rainbow-colored circles. This is designed to be used with textures that are twice as high as they are wide.
    设计用于复杂的耀斑,1个高清晰,2个中等,8个小图像。这个用于标准的50mm变焦眩光资源,其中2个中等元素是彩虹光圈。使用的纹理高是宽的2两倍。
  • 1 Texture
    单一纹理 单一纹理
    A single image. 一个单一图像。
  • 2x2 grid
    2x2网格 2x2网格
    A simple 2x2 grid. 一个简单的2x2网格
  • 3x3 grid
    3x3网格 3x3网格
    A simple 3x3 grid. 一个简单的3x3网格
  • 4x4 grid
    4x4网格 4x4网格
    A simple 4x4 grid. 一个简单的4x4网格

Hints 提示

  • If you use many different Flares, using a single Flare Texture that contains all the Elements will give you best rendering performance.
    如果你使用了许多不同的耀斑,使用单一耀斑纹理(Flare Texture)去包含所有元素(Elements ),这会给你带来最好的渲染性能。
  • 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.
    镜头光晕被碰撞器(Colliders)阻挡。一个在耀斑游戏物体和相机之间的碰撞器,这会把耀斑隐藏掉,即使碰撞器没有网格渲染器(Mesh Renderer.)。