Unity 编辑器学习(二)之 全局光照(GI)

光影流年,花影阡陌。光与影交织的岁月教育我们,不会使用光照的程序员不是个好美术。

 

一、概述

点击 Window > Lighting > Settings 会弹出Lighting窗口,这个就是设置全局光照的窗口。

这个Lighting窗口划分了三个区域:

1、Scene:设置适用于整个场景而不是单个GameObjects。这些设置控制灯光效果和优化选择。

2、Global maps:显示所有lightmap资产文件生成的GI照明过程。

3、Object maps:预览当前选中的GameObject的GI lightmap纹理(包括阴影遮罩)。

下方有一个Auto Generate,勾上它,unity就会自动更新Lightmap 数据,但更新的过程非常耗时,

因此不建议勾选 Auto Generate。可以手动点击Generate Lighting来烘焙。(注意,unity只会烘焙

勾选了Lightmap Static 的GameObject,so 烘焙之前,首先在Inspector 面板最上方的Static 选中Lightmap Static)

 

二、Scene tab

Scene 这一模块,包括以下六个部分:

  • Environment
  • Realtime Lighting
  • Mixed Lighting
  • Lightmapping Settings
  • Other Settings
  • Debug Settings

1、Environment

环境光部分包含设置天空盒,漫反射和镜面反射。

Property:Function:
Skybox Material天空盒材质
Sun Source设置一个定向光(directional Light)作为场景里的太阳,如果设置为None,unity则将最亮的定向光作为太阳(太阳:不管你设置的多大远多,光都会照到场景里)
Environment Lighting环境光设置
Source漫反射环境光(背景光),默认以天空盒作为环境光。
    Color以某种颜色作为环境光。
    Gradient //梯度sky, horizon and ground分别选择一种颜色,混合出一种环境光。
    Skybox天空盒作为环境光,
Intensity Multiplier//光照强度环境光的亮度,范围是0-8,默认为1。
Ambient Mode //微光模式场景中GI的模式。
    Realtime实时更新。
    Baked烘焙(预先计算场景中的灯光)。
Environment Reflections全局设置反射参数。
Source反射源。
    Skybox天空盒作为反射源。
    Custom用一个cube map作为反射源。
Compression//压缩反射贴图是否被压缩。
    Auto如果适合压缩,那就压缩。
    Uncompressed不压缩。
    Compressed压缩
Intensity Multiplier反射光的强度。
Bounces//反弹一束光的被反射的次数。

 

2、Realtime Lighting

Property:Function:
Realtime Global Illumination是否开启实时全景光照。

 

3、Mixed Lighting

 

Property:Function:
Baked Global Illumination是否采用烘焙的全局光照。
Lighting Mode决定混合灯光和GameObject的阴影,修改了Light Mode需要重新烘焙。
Realtime Shadow Color实时阴影的颜色。 

 

4、Lightmapping Settings 

Property:Function:
LightmapperUse this to specify which internal lighting calculation software to use to calculate lightmaps in the Scene. The options are Enlighten and Progressive (experimental). The default value is Enlighten. 
See documentation on the Progressive Lightmapper for more information about the experimental Progressive Lightmapper feature.
Indirect ResolutionUse this value to specify the number of texels per unit to use for indirect lighting calculations. Increasing this value improves the visual quality of indirect light, but also increases the time it takes to bake lightmaps. The default value is 2.
Lightmap ResolutionUse this value to specify the number of texels per unit to use for lightmaps. Increasing this value improves lightmap quality, but also increases bake times. The default value is 40.
Lightmap PaddingUse this value to specify the separation (in texel units) between separate shapes in the baked lightmap. The default value is 2.
Lightmap SizeThe size (in pixels) of the full lightmap texture, which incorporates separate regions for the individual object textures. The default value is 1024.
Compress LightmapsA compressed lightmap requires less storage space, but the compression process can introduce unwanted visual effects into the texture. Tick this checkbox to compress lightmaps, or untick it to keep them uncompressed. The checkbox is ticked by default.
Ambient OcclusionWhen ticked, this opens a group of settings which allow you to control the relative brightness of surfaces in ambient occlusion. Higher values indicate a greater contrast between the occluded and fully lit areas. This is only applied to the indirect lighting calculated by the GI system. This setting is enabled by default.
    Max DistanceSet a value to control how far rays are cast in order to determine whether an object is occluded or not. A larger value produces longer rays and contributes more shadows to the lightmap, while a smaller value produces shorter rays that contribute shadows only when objects are very close to one another. A value of 0 casts an infinitely long ray that has no maximum distance. The default value is 1.
    Indirect ContributionUse the slider to scale the brightness of indirect light as seen in the final lightmap (that is, ambient light, or light bounced and emitted from objects) from a value between 0 and 10. The default value is 1. Values less than 1 reduce the intensity, while values greater than 1 increase it.
    Direct ContributionUse the slider to scale the brightness of direct light from a value between 0 and 10. The default value is 0. The higher this value is, the greater the contrast applied to the direct lighting.
Final GatherWhen Final Gather is enabled, the final light bounce in the GI calculation is calculated at the same resolution as the baked lightmap. This improves the visual quality of the lightmap, but at the cost of additional baking time in the editor.
    Ray CountUse this value to define the number of rays emitted for each final gather point. The default value is 256.
    DenoisingTick this checkbox to apply a denoising filter to the final gather output. This box is ticked by default.
Directional ModeYou can set the lightmap up to store information about the dominant incoming light at each point on the objects’ surfaces. 
See documentation on Directional Lightmapping for further details. The default mode is Directional.
    DirectionalIn Directional mode, a second lightmap is generated to store the dominant direction of incoming light. This allows diffuse normal mapped materials to work with the GI. Directional mode requires about twice as much storage space for the additional lightmap data.
    Non-directionalNon-directional mode switches both these options off. 
Indirect IntensityUse this slider to control the brightness of indirect light stored in realtime and baked lightmaps, from a value between 0 and 5. A value above 1 increases the intensity of indirect light while a value of less that 1 reduces indirect light intensity. The default value is 1.
Albedo BoostUse this slider to control the amount of light bounced between surfaces by intensifying the albedo of materials in the Scene, from a value between 1 and 10. Increasing this draws the albedo value towards white for indirect light computation. The default value of 1 is physically accurate.
Lightmap ParametersUnity uses a set of general parameters for the lightmapping in addition to properties of the Lighting window. A few defaults are available from the menu for this property but you can also create your own lightmap parameter file using the Create New option. See the Lightmap Parameters page for further details. The default value is Default-Medium.

5、Other Settings

Property:Function:
Other SettingsSettings for fog, HalosFlares and Cookies.
FogEnables or disables fog in the Scene. Note that fog is not available with the Deferred rendering path. For deferred rendering, the Global Fog effect may suit your needs.
    ColorSet the color Unity uses to draw fog in the Scene.
    ModeDefine the way in which the fogging accumulates with distance from the camera.
        LinearFog density increases linearly with distance.
            StartSet the distance from the Camera at which the fog starts.
            EndSet the distance from the Camera at which the fog completely obscures Scene GameObjects.
        ExponentialFog density increases exponentially with distance.
            DensityUse this to control the density of the fog. The Fog appears more dense as the Density increases.
        Exponential SquaredFog density increases even faster than exponentially with distance (exponentially and squared).
            DensityUse this to control the density of the fog. The Fog appears more dense as the Density increases.
Halo TextureSet the Texture you want to use for drawing a Halo around lights.
Halo StrengthDefine the visibility of halos around lights, from a value between 0 and 1.
Flare Fade SpeedDefine the time (in seconds) over which lens flares fade from view after initially appearing. This is set to 3 by default.
Flare StrengthDefine the visibility of lens flares from lights, from a value between 0 and 1.
Spot CookieSet the Cookie texture you want to use for spot lights.

6、Debug settings

Property:Function:
Debug SettingsSettings that help you debug your Scene.
Update StatisticsIf ticked, the statistics window at the bottom of the Lighting settings window is updated as the Scene changes. This can have an impact on performance during Play mode. For better performance in Play mode, untick this box.
Light Probe VisualizationUse this to filter which Light Probes are visualized in the Scene view. The default value is Only Probes Used By Selection.
    Only Probes Used By SelectionOnly Light Probes that affect the current selection are visualized in the Scene view.
    All Probes No CellsAll Light Probes are visualized in the Scene view.
    All Probes With CellsAll Light Probes are visualized in the Scene view, and the tetrahedrons that are used for interpolation of Light Probe data are also displayed.
    NoneNo Light Probes are visualized in the Scene view.
Display WeightsWhen ticked, Unity draws a line from the Light Probe used for the active selection to the positions on the tetrahedra used for interpolation. This is a way to debug probe interpolation and placement problems.
Display OcclusionWhen ticked, Unity displays occlusion data for Light Probes if the Mixed lighting mode is Distance Shadowmask or Shadowmask.

 

三、Global maps tab

 

转载于:https://www.cnblogs.com/Jason-c/p/7567421.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Unity 编辑器中显示维数组可以使用多种方法,以下是其中两种常见的方法: 1. 在 Inspector 窗口中使用自定义编辑器脚本 编写一个继承自 Editor 类的自定义编辑器脚本,然后将其挂载到包含维数组的 GameObject 上。在脚本中,可以使用 SerializedProperty 类访问维数组的每个元素并在 Inspector 窗口中显示它们。示例代码如下: ```csharp using UnityEditor; using UnityEngine; [CustomEditor(typeof(MyScript))] public class MyScriptEditor : Editor { SerializedProperty myArray; void OnEnable() { myArray = serializedObject.FindProperty("myArray"); } public override void OnInspectorGUI() { serializedObject.Update(); EditorGUILayout.PropertyField(myArray, true); serializedObject.ApplyModifiedProperties(); } } ``` 其中,MyScript 是包含维数组的脚本,myArray 是维数组的 SerializedProperty 对象。 2. 在场景中使用 GUI 控件 在场景中使用 GUI 控件可以在游戏运行时或编辑器运行时显示维数组。可以使用 GUILayout 或 EditorGUI 中的控件来创建表格或网格来显示维数组。示例代码如下: ```csharp using UnityEngine; public class MyScript : MonoBehaviour { public int[,] myArray = new int[3, 3]; void OnGUI() { for (int i = 0; i < myArray.GetLength(0); i++) { GUILayout.BeginHorizontal(); for (int j = 0; j < myArray.GetLength(1); j++) { myArray[i, j] = EditorGUILayout.IntField(myArray[i, j], GUILayout.Width(50)); } GUILayout.EndHorizontal(); } } } ``` 在该示例中,使用 GUILayout.BeginHorizontal 和 GUILayout.EndHorizontal 创建每行,使用 EditorGUILayout.IntField 显示维数组的每个元素,并使用 GUILayout.Width 控制每个元素的宽度。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值