Lighting Data Asset
Lightmaps: Technical information

Lightmap Directional Modes

There are two Directional Modes available for light maps: Directional and Non-Directional. To set the Directional Mode for a light map, open the Lighting window (Window > Lighting > Settings), click SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
, navigate to the Lightmapping Settings, ensure the LightmapperA tool in Unity that bakes lightmaps according to the arrangement of lights and geometry in your scene. More info
See in Glossary
is set to EnlightenThe lighting system by Geomerics used in Unity for computing global illumination (GI). More info
See in Glossary
, and use the Directional Mode drop-down menu. Both are available as real-time and baked lightmaps.

Directional light maps store more information about the lighting environment than Non-Directional light maps. ShadersA small script that contains the mathematical calculations and algorithms for calculating the Color of each pixel rendered, based on the lighting input and the Material configuration. More info
See in Glossary
can use that extra data about incoming light to better calculate outgoing light, which is how materials appear on the screen. This happens at the cost of increased texture memory usage and shading time.

Non-directional: flat diffuse. This mode uses just a single lightmapA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
See in Glossary
, storing information about how much light does the surface emit, assuming it’s purely diffuse. Objects lit this way will appear flat (normalmaps won’t be used) and diffuse (even if the material is specular), but otherwise will be lit correctly. These barrels are using baked lightmaps. The only detail definition comes from a reflection probeA rendering component that captures a spherical view of its surroundings in all directions, rather like a camera. The captured image is then stored as a Cubemap that can be used by objects with reflective materials. More info
See in Glossary
and an occlusion map.

Directional: normal mapped diffuse. This mode adds a secondary lightmap, which stores the incoming dominant light direction and a factor proportional to how much light in the first lightmap is the result of light coming in along the dominant direction. The rest is then assumed to come uniformly from the entire hemisphere. That information allows the material to be normal mapped, but it will still appear purely diffuse.

Performance

Directional mode uses twice as much texture memory as Non-directional mode and has a slightly higher shading cost.

  • Non-directional: one texture, one texture sample, a few extra shader instructions.

  • Directional: two textures, two texture samples, a few more extra shader instructions.

Real-time lightmaps take advantage of the same approach, and are subject to the same shading quality/cost tradeoffs.

The BRDF that is actually used for indirect light (the indirect part of baked) is a slightly less expensive version. UNITY_BRDF_PBS_LIGHTMAP_INDIRECT is defined in UnityPBSLighting.cginc.

Specular lighting on light maps

To achieve specular light on lightmap static assets, use the Light Modes ShadowmaskA Texture that shares the same UV layout and resolution with its corresponding lightmap. More info
See in Glossary
or Distance ShadowmaskA version of the Shadowmask lighting mode that includes high quality shadows cast from static GameObjects onto dynamic GameObjects. More info
See in Glossary
on Baked lightsA Light Mode for creating local ambience, rather than fully featured lights for increasing brightness in dark areas without needing to adjust all of the lighting within a Scene. Unity pre-calculates the illumination from these lights before run time, and does not include them in any run-time lighting calculations. More info
See in Glossary
. This ensures the light is real-time and high quality. See documentation on Light ModesA Light property that defines the use of the Light. Can be set to Realtime, Baked and Mixed. More info
See in Glossary
for more information.)


  • 2017–06–08 Page published with limited editorial review

  • Direct Specular removed in 5.6

  • Light Modes added in 5.6

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答