This an introductory description of lightmapping in Unity. For more advanced topics see in-depth description of lightmapping in Unityhtml
這是一個Unity 光照貼圖的引導手冊。若是想查看更多的高級功能請查看in-depth description of lightmapping in Unity。app
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能夠根據你的網格物體,材質貼圖和燈光屬性的設置來烘培你的場景,從而獲得完美的光照貼圖。同時也意味着光照圖將做爲渲染引擎的一部分。只要你烘培一次光照貼圖你就不須要其餘任何操做。光照圖將自動指定到物體上。ide
Selecting Window – Lightmapping from the menu will open the Lightmapping window:工具
從菜單欄選擇Window – Lightmapping打開光照圖工具窗口。ui
Scene and game views will update - your scene is now lightmapped!this
場景和遊戲窗口將會更新。如今在你的場景中已經能夠看到光照貼圖效果了!spa
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.orm
最終場景的渲染效果取決與你對燈光和烘培選項的更多設置。讓咱們來看一個經過基礎設置改進光照的質量的小例子。htm
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。可以烘培出帶有微妙變化的反射效果的軟光源。(會從綠色和藍色的盒子上產生色彩溢出)。
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。