Unity 3D 光照贴图快速入门 Lightmapping Quickstart

This an introductory description of lightmapping in Unity. For more advanced topics see in-depth description of lightmapping in Unity

这是一个Unity 光照贴图的引导手册。如果想查看更多的高级功能请查看in-depth description of lightmapping in Unity

Unity has a built-in lightmapper: it's Beast by Illuminate Labs. Lightmapping is fully integrated in Unity. This means that Beast will bake lightmaps for your scene based on how your scene is set up within Unity, taking into account meshes, materials, textures and lights. It also means that lightmapping is now an integral part of the rendering engine - once your lightmaps are created you don't need to do anything else, they will be automatically picked up by the objects.

Unity内置的光照贴图烘培工具是Illuminate Labs 的Beast。烘培光照贴图流程被完美的整合到Unity中。这就意味着使用Beast可以根据你的网格物体,材质贴图和灯光属性的设置来烘培你的场景,从而得到完美的光照贴图。同时也意味着光照图将作为渲染引擎的一部分。只要你烘培一次光照贴图你就不需要其他任何操作。光照图将自动指定到物体上。

光照贴图

Preparing the scene and baking the lightmaps
准备需要烘培的光照贴图的场景

Selecting Window – Lightmapping from the menu will open the Lightmapping window:

从菜单栏选择Window – Lightmapping打开光照图工具窗口。

  1. Make sure any mesh you want to be lightmapped has proper UVs for lightmapping. The easiest way is to choose the Generate Lightmap UVs option in mesh import settings. 
    检查你将要烘培的模型上是否存在一个合适的用来定位光照贴图的UVs。你也可以从mesh import settings面板中的勾选Generate Lightmap UVs选项来生成一个用于定位光照图UV的集。
  2. In the Object pane mark any Mesh Renderer or Terrain as static – this will tell Unity, that those objects won't move nor change and they can be lightmapped.
    在物体面板中将要烘培光照贴图的物体设置为Static(静态),这样Unity就会知道哪些物体是需要被烘培的。 
  3. To control the resolution of the lightmaps, go to the Bake pane and adjust the Resolution value. (To have a better understanding on how you spend your lightmap texels, look at the small Lightmap Display window within the Scene View and select Show Resolution).
    在Bake面板下调整Resolution的值控制光照贴图的分辨率。(在Scene View面板里勾选上小窗口Lightmap Display中的Show Resolution选项可以帮助你更直观的查看贴图分辨率设置)。 
  4. Press Bake 
    点击Bake(烘培)
  5. A progress bar appears in Unity Editor's status bar, in the bottom right corner. 
    在Unity编辑器底部的状态栏的右边会出现一个进度条。
  6. When baking is done, you can see all the baked lightmaps at the bottom of the Lightmap Editor window. 
    当烘培结束时,你可以从光照图编辑器的底部预览窗口中查看所有烘培好的贴图。

Scene and game views will update - your scene is now lightmapped!

场景和游戏窗口将会更新。现在在你的场景中已经可以看到光照贴图效果了!

Tweaking Bake Settings 调节烘焙设置

Final look of your scene depends a lot on your lighting setup and bake settings. Let's take a look at an example of some basic settings that can improve lighting quality.

最终场景的渲染效果取决与你对灯光和烘培选项的更多设置。让我们来看一个通过基础设置改进光照的质量的小例子。

This is a basic scene with a couple of cubes and one point light in the centre. The light is casting hard shadows and the effect is quite dull and artificial.

这是一个简单的场景,包含一组立方体和一个位于场景中心的点光源。灯光产生硬阴影,看起来效果相当平淡而不自然。

Selecting the light and opening the Object pane of the Lightmapping window exposes Shadow Radius and Shadow Samples properties. Setting Shadow Radius to 1.2, Shadow Samples to 100 and re-baking produces soft shadows with wide penumbra - our image already looks much better.

选择灯光打开物体面板,展开阴影范围和阴影采样属性。设置阴影范围为1.2,阴影采样为100重新烘培,会产生一个半影范围很宽的软阴影。我们画面看起来真的好多了。
 

With Unity Pro we can take the scene one step further by enabling Global Illumination and adding a Sky Light. In the Bake pane we set the number of Bounces to 1 and the Sky Light Intensity to 0.5. The result is much softer lighting with subtle diffuse interreflection effects (color bleeding from the green and blue cubes) - much nicer and it's still only 3 cubes and a light!

使用专业版Unity能够开启全局光照和天光进行烘培画面效果能得到更大的改进。在Bake(烘培)面板设置Bounces(反弹)为1,Sky Light Intensity天光强度为0.5。能够烘培出带有微妙变化的反射效果的软光源。(会从绿色和蓝色的盒子上产生色彩溢出)。

 

Lightmapping In-Depth 光照贴图深入了解

For more information about the various lightmapping-related settings, please refer to the in-depth description of lightmapping in Unity.

更多的和光照贴图设置有关的信息请查阅in-depth description of lightmapping in Unity

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

posted on 2019-02-01 12:12  jack船长大哥  阅读(936)  评论(0编辑  收藏  举报

导航