• Unity Lighting


     

    Light Types 灯光类型

     

    We have now covered some of the project settings which need to be considered before beginning work on lighting your scenes in Unity. Hopefully at this point you should have your project configured appropriately for your target platform (generally Baked GI and Gamma Color Space for mobile, Precomputed Realtime GI and Linear Color Space for Standalone PC or recent games consoles).

    现在我们已经介绍了在Unity开始渲染场景之前需要考虑的一些项目设置。 希望在这一点上,您应该为您的目标平台(通常是烘焙GI和Gamma颜色空间用于移动设备,预计算实时GI以及线性颜色空间用于独立PC或最近游戏机的)配置您的项目。 

     

    Let’s move on to looking at the tools available for achieving the lighting you want in your game.

    让我们继续看看可用于实现游戏中想要的照明的工具。

    Directional Lights 方向光

    ‘Directional Lights’ are very useful for creating effects such as sunlight in your scenes. Behaving in many ways like the sun, Directional Lights can be thought of as distant light sources which exist infinitely far away.

    '方向光'对于在场景中创建诸如阳光等效果非常有用。在许多方面像太阳一样,方向光可以被认为是无限远的远距离光源。

    Light rays emitted from Directional Lights are parallel to one another and do not diverge like those from other light types. As a result, shadows cast by Directional Lights look the same, regardless of their position relative to the source. This is useful to us, especially when lighting outdoor scenes.

    方向光发出的光线相互平行,不像其他光源那样发散。因此,方向光投射的阴影看起来是相同的,不管它们相对于源的位置如何。这对我们很有用,特别是在室外场景照明时。

    Directional Light

    As Directional Lights do not have a source position, they can be placed anywhere in your scene without changing the effect of the light. Rotating the light however does greatly affect the visual result.

    由于方向光源没有光源位置,因此它们可以放置在场景中的任何位置,而不会改变光源的效果。然而,旋转灯光会大大影响视觉效果。

    With other light types where there is an obvious source position, such as Spotlights, character shadows will change as the character moves closer to the light source. This can be a problem when trying to generate character shadows in interior levels. Directional lights are advantageous in these situations as shadows remain consistent regardless of proximity to the light source.

    对于具有明显源位置的其他灯光类型(例如聚光灯),角色阴影将随着角色靠近光源而改变。尝试在关卡内部生成角色阴影时,这可能是一个问题。方向灯在这些情况下是有利的,因为阴影保持一致而与光源无关。

    Directional Lights do not diminish over distance. As they affect all surfaces in your scene (unless culled), they pose a performance cost when using the Deferred Rendering path. Remember that when using this rendering technique, the performance cost of a light is relative to the number of pixels it illuminates. However, despite the cost, performance will at least be consistent and as such, easier to balance.

    方向光不会随着距离而减少。由于它们会影响场景中的所有表面(除非被舍弃),它们在使用延迟渲染路径时会产生性能成本。请记住,使用这种渲染技术时,灯的性能成本与其照射的像素数有关。但是,尽管成本高昂,性能至少会保持一致,因此更易于平衡。

    By default, every new Unity scene contains a Directional Light. In Unity 5, this is linked to the procedural sky system defined in the Environment Lighting section of the Lighting Panel (Lighting>Scene>Skybox). You can change this behaviour by deleting the default Directional Light and creating a new light or simply by specifying a different GameObject from the ‘Sun’ parameter (Lighting>Scene>Sun).

    默认情况下,每个新的Unity场景都包含一个方向光。在Unity 5中,这与Lighting面板的环境照明部分(Lighting> Scene> Skybox)中定义的程序天空系统相关联。您可以通过删除默认方向灯并创建新灯光或仅通过从“Sun”参数(Lighting> Scene> Sun)中指定不同的GameObject来更改此行为。

    Rotating the default Directional Light (or ‘Sun’) causes the ‘Skybox’ to update. With the light angled to the side, parallel to the ground, sunset effects can be achieved. Additionally, pointing the light upwards causes the sky to turn black, as if it’s nighttime. With the light angled from above, the sky will resemble daylight.

    旋转默认的方向灯(或'太阳')会导致'天空盒'更新。通过与地面平行的光线,可以实现夕阳效果。另外,将光线向上指向会使天空变黑,就像夜晚一样。随着从上方倾斜的光线,天空将像日光。

    If the Skybox is selected as the ambient source, Ambient Lighting will change in relation to these colors.

    如果选择Skybox作为环境光源,Ambient Lighting将根据这些颜色进行更改。

    Point Lights 点光

    A Point Light can be thought of as a point in 3D space from which light is emitted in all directions. These are useful for creating effects like light bulbs, weapon glow or explosions where you expect light to radiate out from an object.

    点光源可以被认为是三维空间中从所有方向发射光线的一个点。 这些对于创建灯泡,武器发光或爆炸等效果非常有用,因为您希望光线能够从物体中散发出来。

    The intensity of of Point Lights in Unity diminishes quadratically from full intensity at the centre of the light, to zero at the limit of the light’s reach defined by the ‘Range’ property of the component in the Inspector. Light intensity is inversely proportional to the square of the distance from the source. This is known as ‘inverse square law’ and is similar to how light behaves in the real world.

    点光源在Unity中的强度从光源中心的全部强度按照二次方减小到在检测器中的组件的“Range(范围)”属性定义的光线范围内为零。 光强度与距光源距离的平方成反比。 这被称为“反平方律”,与光在现实世界中的表现类似。

    Point LightPoint Lights emit light in all directions from their position in the world. The spherical gizmo represents the ‘Range’ of the Light. Direct Light will ‘Falloff’ to zero when it reaches this limit, however bounced - or indirect light can continue much further.

    点光源从它们在世界上的位置向各个方向发射光线。 球形Gizmo代表了光的'范围'。 当光线达到此限制时,直射光会“衰减”到零,但是反射 - 或间接光线可以继续更进一步。

    Enabling shadows for Point Lights can be expensive and so must be used sparingly. Point Lights require that shadows have to be rendered six times for the six world directions and on slower hardware this can be an unacceptable performance cost.

    为点光源启用阴影可能非常消耗性能,因此必须谨慎使用。 点光源要求六个世界方向上的阴影故必须渲染六次,而在较慢的硬件上,这可能是不可接受的性能成本。

    When adding Point Lights to a scene it’s worth noting that currently they do not support indirect bounce light shadowing.This means that the light created by Point Lights will continue through objects and bounce on the other side unless attenuated by range. This can lead to light ‘leaks’ through walls and floors and therefore lights must be carefully placed to avoid such problems. This however is not a problem when using Baked GI.

    将点光线添加到场景时,值得注意的是,目前它们不支持间接反弹光线投影。这意味着由点光源创建的光线将继续穿过物体并在另一侧反射,除非被范围衰减。 这可能会导致墙壁和地板发出“漏光”,因此灯必须小心放置以避免出现此类问题。 然而,这在使用烘焙GI时不是问题

    Spotlights 聚光灯

    Spotlights project a cone of light in their forward (+Z) direction. The width of this cone is defined by the light’s ‘Spot Angle’ parameter. Light will ‘falloff’ from the source position towards the extent of the light’s range, where it will eventually diminish to zero. Light also diminishes at the edges of the Spotlight’s cone. Widening the Spot Angle increases the width of the cone and with it, increases the size of this fade, known as the ‘penumbra’.

    投光灯向前(+ Z)方向投射光锥。 该锥体的宽度由灯的“Spot Angle”参数定义。 光线将从光源位置向光线范围内“衰减”,最终会减小到零。 聚光灯锥体边缘的光线也会减少。 加宽光斑角度会增加圆锥体的宽度并随之增加这种渐变的大小,称为“半影”。

    Spotlight Penumbra

    Spotlights have many useful applications for scene lighting. They can be used to great effect as street lights, wall downlights or used dynamically, for creating effects like a flashlight. As their area of influence can be precisely controlled, Spotlights are extremely useful for creating focus on a character or for creating dramatic stage lighting effects

    聚光灯有许多有用的场景照明应用。 它们可以用作路灯,壁灯或动态使用,用于创建手电筒等效果。 由于它们的影响范围可以精确控制,因此聚光灯对于创造角色焦点或创造戏剧性的舞台灯光效果非常有用

    SpotlightLight will diminish as distance increases from the source. Notice how light also fades towards the edges of the cone. We call this the Light’s penumbra and this increases as the angle of the cone increases.

    随着距离距离的增加,光线会减弱。 注意光线也向锥体边缘消失。 我们称之为光线的半影,半影衰减随着锥体角度的增加而增加。

    Like Point Lights, Spotlights do not presently support indirect shadowing when using Precomputed Realtime GI. This means that light produced by Spotlights will travel through geometry and will bounce on the other side. Placement therefore needs to be carefully considered.

    与点光源一样,使用预计算实时GI时,聚光灯目前不支持间接投影。 这意味着聚光灯产生的光线将穿过几何体并在另一侧反弹。 因此需要仔细考虑安置。

    Area Lights 区域灯

    Area Lights can be thought of as similar to a photographer’s softbox. In Unity they are defined as rectangles from which light is emitted in all directions, from one side only - the object’s +Z direction. Presently only available in Baked GI, these Area Lights illuminate uniformly across their surface area. There is no manual control for the range of an Area Light, however intensity will diminish at inverse square of the distance as it travels away from the source.

    区域灯可以被认为与摄影师的柔光盒相似。 在Unity中,它们被定义为从所有方向发射光的矩形,仅从一侧 - 对象的+ Z方向。 目前仅在烘焙GI中可用,这些区域灯在其表面区域均匀照射。 区域光的范围没有手动控制,但强度在距离光源远处的反平方时会减小。

    Area LightsLight is emitted across the surface of an Area Light producing a diffuse light with soft shadowing.

    光线通过面光源的表面发射,产生柔和阴影的漫射光线。

    Area Lights are useful in situations where you wish to create soft lighting effects. As light is emitted in all directions across the surface of the light, the rays produced travel in many directions - creating a diffuse lighting effect across a subject. A common use for this might be a ceiling striplight or a backlit panel.

    面光源在您希望创建柔和光照效果的情况下非常有用。 随着光线在光线的各个方向上发射,产生的光线将沿多个方向传播 - 在物体之间产生漫射照明效果。 常见的用途可能是天花板灯条或背光面板。

    In order to achieve this, we must fire a number of rays from each lightmap texel in the world, back towards the light in order to determine whether the light can be seen. This means that Area Lights can be quite computationally expensive and can increase bake times. However, used well, they can add a great depth of realism to your scene lighting and this extra precomputation may be justified. Note that as they are baked only, gameplay performance is not affected.

    为了达到这个目的,我们必须从世界上每个光照贴图纹理中发射出一些光线,然后回到光线,以确定光线是否可以被看到。 这意味着区域灯可能在计算上相当昂贵,并且会增加烘烤时间。 但是,如果使用得当,它们可以为您的场景照明添加深度的真实感,并且这种额外的预计算可能是合理的。 请注意,由于它们仅被烘焙,所以游戏性能不受影响。


    <wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

  • 相关阅读:
    我是怎么找到电子书的

    task1
    centos7 部署 nginx+tomcat+MariaDB 环境并安装安全狗,使用natapp隧道
    CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置
    mysql 配置 root 远程访问
    tomcat 配置 https 证书
    how2j 的shiro教程初探
    springboot 设置 session 过期时间
    mybatis 异常 too many connections 解决方案 mysql
  • 原文地址:https://www.cnblogs.com/CloudLiu/p/9894550.html
Copyright © 2020-2023  润新知