Set up your scene and lights for baking
Set up meshes and GameObjects so that they store precalculated color in lightmaps.
読み終わるまでの所要時間 2 分最終更新 1ヶ月前
Before you set up your scene, choose which backend Unity uses to bake your lighting. The backend you select determines which lighting settings are available and how some of them behave. For more information, refer to Choose a light baking backend.
Select Window > Rendering > Lighting from the Unity Editor menu to open the Lighting window. Make sure any Mesh you want to apply a lightmap to has proper UVs for lightmapping. The easiest way to do this is to open the Mesh import settings and enable the Generate Lightmap UVs setting.
Next, to control the resolution of the lightmaps, go to the Lightmapping Settings section and adjust the Lightmap Resolution value.
To be included in your lightmap, Renderers must meet the following criteria:
- Have a orMesh Renderer
?
componentTerrain?
- Be marked as Contribute GI
- Use a built-in Unity Material or shader that supports lightmaps, or a shader in the Built-In Render Pipeline with a Meta Pass.
You can adjust settings for Lights in the Light Explorer. To open the Light Explorer, go to Window > Rendering > Light Explorer.
Static versus Dynamic
No matter which Global Illumination system you use, Unity will only consider objects that are marked as “Contribute GI” during the baking/precomputing of the lighting. Dynamic (i.e. non-static) objects have to rely on the Light Probes you placed throughout the scene to receive indirect lighting.
Because the baking/precomputing of the lighting is a relatively slow process, only large and complex assets with distinct lighting variations, such as concavity and self-shadowing, should be tagged as “Contribute GI”. Smaller and convex meshes that receive homogeneous lighting should not be marked as such, and they should, therefore, receive indirect lighting from the Light Probes which store a simpler approximation of the lighting. Larger dynamic objects can rely on LPPVs, in order to receive better localized indirect lighting. Limiting the number of objects tagged as “Contribute GI” in your scene is absolutely crucial to minimize baking times while maintaining an adequate lighting quality.