Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Official Lightmapping Troubleshooting Guide

Discussion in 'Global Illumination' started by kristijonas_unity, Sep 26, 2022.

  1. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Last edited: Oct 2, 2022
  2. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 1: No baked global illumination in the scene
    Figure 1. Cornell Box scene rendered with no global illumination (left) and with baked global illumination (right).

    1.1 Why does this happen?
    If some prerequisites are not met, Progressive Lightmapper might fail to generate lighting in your scene. These include, but are not limited to:
    • No objects are marked as GI Contributors
    • No baked lights in the scene
    • Shader issues
    1.2 How to fix it?
    1.2.1 Mark GameObjects as GI Contributors

    Figure 2. Contribute GI settings under the Mesh Renderer component.

    Mark objects you want to lightmap as GI Contributors. To do so follow these steps:
    1. Select your GameObject.
    2. Navigate to the Mesh Renderer component.
    3. Unfold the Lighting header.
    4. Check the Contribute to Global Illumination checkbox.
    Doing so will enable the Receive Global Illumination parameter underneath. It contains two options:
    • Lightmaps. Meant for static lightmapped objects. GameObject will receive and contribute GI to lightmaps.
    • Light Probes. Meant for small props, and objects not fit for lightmapping. GameObject will receive GI from light probes and will contribute GI to the surrounding lightmaps.
    1.2.2 Inspect scene lights
    Only mixed and baked lights can contribute to baked GI. Select lights in your scene, and make sure that in the Light component, Mode is set to either Mixed or Baked.

    Other properties which are worth checking are:
    • Color. Dark colors will have low or no GI contribution. Choose bright colors for lights and use the Intensity property to boost or dim them.
    • Intensity. The higher the intensity, the brighter the light. Ensure that your lights are bright enough for meaningful GI contribution.
    • Indirect Multiplier. This property controls the intensity of the indirect bounce. Make sure that it is not set to zero. Otherwise, the light will have no contribution to GI at all. Note that setting this value above one will make the lighting in your scene non-compliant with the PBR standard.
    1.2.3 Inspect the Lighting Setting Asset
    In the Lighting window, accessible via Window > Rendering > Lighting, make sure that the Lighting Settings Asset field is not blank. If there is no asset assigned, click on the New Lighting Settings button. This will create and assign an asset, unlocking the properties in the window for editing.

    Once you have done that, check for the following issues:
    • Ensure that you have ticked the Baked Global Illumination checkbox. This enables baked GI computations. This checkbox will also expose the Lighting Mode dropdown.
    • Check that the Max Bounces value is not set to zero. The higher this value, the more the light will bounce around the environment.
    • Check that the Indirect Intensity slider is not set to zero. Setting this slider to zero will diminish all indirect lighting in the scene.
    1.2.4 Inspect shaders and materials
    Custom shaders could be the reason why GI computation has failed. For debug purposes, use built-in shaders that come with the Unity editor. Those are:
    • Standard shader. Available in the built-in render pipeline.
    • Lit shader. Available in the Universal Render Pipeline.
    • Lit shader. Available in the High-Definition Render Pipeline.
    If Unity generates lighting after switching to one of the shaders outlined above, the problem might be with custom shaders. In such cases, make sure that your surface shaders contain the LIGHTMAP_ON shader keyword.

    Check out the meta pass page on how to further customize the baked GI output using shaders.

    1.2.5 Other potential fixes
    If the above-mentioned steps did not solve the problem, please try the following:
    • Make sure that the lights are not placed inside scene geometry.
    • Enable Mixed Lighting toggle in the Universal Render Pipeline Asset.
    • Select a different lightmapping backend in the Lighting window. If lighting fails to bake when using the Progressive GPU, but succeeds when baking with the Progressive CPU, this might be a result of a hardware or driver problem.
    • Update the GPU drivers. Please refer to the GPU manufacturer’s page for the correct drivers for your system. For Linux machines, please check the Linux driver setup section in this forum thread.
    • Ensure that your GPU meets the minimum requirements. Please refer to this forum thread for details.
    • Clear the GI Cache. To clear it, navigate to Preferences > GI Cache and click on the Clean Cache button. Keep in mind that this will delete all lighting data present in the scene, requiring you to regenerate lighting.
    Last edited: Mar 27, 2023
    M_MG_S, zalogic, Ka92 and 1 other person like this.
  3. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 2: Objects are missing lighting
    Figure 3. Cornell Box scene with a non-lightmapped metallic sphere and a statue. Both objects are black when no light probes or reflection probes are present (left). Diffuse statue is visible when lit by light probes (center). Both the reflective sphere and the statue are visible after placing light probes and reflection probes (right).

    2.1 Why does this happen?
    Certain objects appearing as unlit or out of place may indicate a problem with the scene setup. It often reproduces when dynamic objects have no light probes to sample the lighting from. Glossy metallic materials can appear as black when no local reflection probes are present.

    2.2 How to fix it?
    2.2.1 Place light probes
    Dynamic objects, or GI contributors receiving GI from light probes need light probes to sample indirect lighting data. If none are present, objects will fall back to sampling the Ambient Probe (light and reflection probe which is always present in the scene).

    Set up a Light Probe network in the scene, adding more probes in areas of high importance. Make sure that there are enough light probes to encompass all affected objects. Generate lighting again to see the effect.

    2.2.2 Place reflection probes
    Reflective metallic objects might still render as black, even after placing a dense network of light probes. To shade such objects, you would need to place a Reflection Probe which encompasses the affected object. Generate the lighting again or re-bake the probe in the Reflection Probe Component by clicking the Bake button.

    If you observe black areas in the reflections, try increasing the Bounces count. This will increase the number of bounces, thus creating reflections within reflections. You can access this property in Lighting > Environment > Environment Lighting.

    2.2.3 Inspect Mesh Renderer settings
    Figure 4. Light Probes and Reflection Probes properties need to be set to Blend Probes (or anything else than Off).

    If performing the above-mentioned steps does not solve the issue, inspect the Mesh Renderer component of the affected object. Under the Probes section, make sure that the Light Probes and Reflection Properties are not set to Off.

    2.2.4 Adjust material color values
    Pure black materials will absorb all direct and indirect light. This is physically correct behavior. In real life, no naturally occurring material is completely black. One of the darkest natural materials, coal, measures approximately at 50,50,50 on an RGB luminosity scale.

    Adjust your material color values to follow the physically based shading standards. In the built-in render pipeline, you can use Validate Albedo scene view draw mode to determine whether albedo values are compliant with the Physically Based Rendering (PBR) standard. Use the Rendering Debugger in URP and HDRP to do the same.

    2.2.5 Check scene setup
    If you are working with multiple scenes, make sure that the scene containing lighting is set as the Active Scene. By default, Unity sets the first loaded scene as the active scene, which might have a detrimental effect in the standalone player builds.
    Last edited: Sep 26, 2022
    zalogic and Ka92 like this.
  4. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 3: Emissive materials not rendering
    Figure 5. The plane in the ceiling and the sphere both have emissive materials applied to them (left). Bloom enabled as a post processing effect to give an impression of a glowing material (center). Emissive plane and sphere both marked as GI contributors influencing lighting in the scene (right).

    3.1 Why does this happen?
    There are two types of issues related to emissive material rendering:
    • Emissive materials do not appear as “glowing”. This indicates a post-processing issue.
    • Emissive materials not contributing to global illumination. This indicates an issue with object or material setup.
    3.2 How to fix it?
    3.2.1 Enable bloom in the post processing stack
    To create an impression of a glowing material, enable Bloom in the post processing stack of your choice. Refer to Built-in RP, URP, and HDRP documentation on how to do this.

    3.2.2 Check material properties
    Figure 6. Material inspector in the Built-in render pipeline. We highlighted Emission properties in blue.

    If you intend on using emissive objects for lightmapping, make sure that:
    • You have marked the GameObject in question as a GI Contributor. Due to the self-illuminating nature of emissive objects, you can set their Receive Global Illumination property to Light Probes. This will save space in the lightmap atlas.
    • Global Illumination property is set to Baked in the Material Inspector. This property is available under the Emission input. Refer to Built-in RP, URP, and HDRP documentation for more details.
    3.2.3 Inspect lighting settings
    In the Lighting window, make sure that the Indirect Intensity property is not set to zero. Setting it to zero will disable all indirect lighting, including baked contribution from baked emissive objects.
    Last edited: Sep 26, 2022
    M_MG_S, zalogic and Ka92 like this.
  5. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 4: Flat normal maps
    Figure 7. Non-directional lightmaps with a baked light (left). Directional lightmaps with a baked light (right). Non-directional lightmaps lack the directionality of incoming light, which provides a good representation of relief when using normal maps.

    4.1 Why does this happen?
    When baking in non-directional mode, Unity will not create a separate texture to hold directionality information. This will result in objects looking flat after baking.

    It is worth noting that low frequency normal maps are hard to capture using directionality textures. Such textures will appear flat when generating lighting using fully baked lights.

    4.2 How to fix it?
    4.2.1 Switch to Directional mode
    Figure 8. Directionality mode dropdown in the Lighting settings window.

    In the Lighting window, set the Directional Mode property to Directional. This mode will generate a secondary texture which will store dominant light direction. Normal maps will have a good representation of relief, but will lack specular response.

    4.2.2 Use mixed lights
    Figure 9. Directional lightmaps illuminated by a baked spotlight (left). Directional lightmaps illuminated by a mixed spotlight (right). Notice the improved contrast in the normal maps in the scene lit by the mixed light.

    Mixed lights provide realtime specular and normal response. The Progressive Lightmapper bakes indirect lighting into a lightmap. This combination ensures the highest quality material response when using baked lighting.

    If your project allows for it, switch the light Mode to Mixed in the Light component. Note that mixed lights have the same performance cost as realtime lights. Depending on the Lighting Mode used, mixed lights will cast realtime shadows, but not baked soft shadows.

    4.2.3 Use light probes
    Probe-lit GameObjects will often have a better material response than those lit by baked lights. If your art direction allows for it, set their Receive Global Illumination property to Light Probes in the Mesh Renderer component. Note that you can also use Light Probe Proxy Volume to add a spatial gradient to probe-lit objects.
    M_MG_S, zalogic and Ka92 like this.
  6. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 5: Missing specular response
    Figure 10. A simple scene containing several baked point lights before a lightmap bake (left). Same scene after baking lightmaps (right). Notice that specular highlights are missing after baking.

    5.1 Why does this happen?
    One of the inherent limitations of baked lights is that they do not provide realtime specular response to materials. This means that glossy materials will lack specular highlights after generating lighting.

    5.2 How to fix it?
    5.2.1 Use mixed lights
    Unlike baked lights, mixed lights provide realtime direct specular response to materials. If specular highlights are important in your scene, switch the light Mode to Mixed in the Light component.

    5.2.2 Use emissive proxies
    Figure 11. Same scene but with emissive proxies captured by the reflection probe (left). An alternative perspective showcasing the placement of said proxies (right).

    It is possible to imitate specular response from lights by using emissive objects. To do so, follow these steps:
    1. Place a reflection probe in your scene.
    2. Right-click in the Hierarchy panel and select 3D Object > Sphere.
    3. Select the newly created object and set its Static Editor Flag to Reflection Probe Static.
    4. In the Project panel, create a new material by right-clicking and selecting Create > Material.
    5. Select the newly created material and enable the Emission checkbox. Set the Global Illumination property to None.
    6. Drag and drop the material onto the sphere to assign it.
    7. Place the sphere in the same position as your light.
    8. Generate lighting.
    After following the above-mentioned steps, you should be able to see the emissive objects captured in the reflection probe cubemap. You can hide those objects after baking or set up a Culling Mask in the Camera component.
    M_MG_S, zalogic and Ka92 like this.
  7. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 6: Lights flicker or disappear
    Figure 12. Pixel Light Count set to 0 (left). Pixel Light Count set to 9 (right). Notice that the realtime shadows and specular highlights are missing completely in the image on the left.

    6.1 Why does this happen?
    When using the forward rendering path, Unity converts pixel lights to more performant vertex lights. It happens when the number of pixel lights exceeds a certain value. This can result in flickering or disappearing lights when navigating the scene.

    This limitation affects Built-in and Universal render pipelines only – HDRP is not affected.

    6.2 How to fix it?
    6.2.1 Adjust pixel light count property
    Figure 13. Project Settings window in the Built-in render pipeline (left). URP asset (right). We highlighted properties which increase the pixel light limit.

    It is possible to increase the number of pixel lights Unity renders before converting pixel lights to vertex lights. Here is how to do this:
    • In the Built-in render pipeline, navigate to Project Settings > Quality > Rendering and adjust the Pixel Light Count property.
    • In URP, select the Render Pipeline Asset, and navigate to Lighting > Additional Lights. Make sure that the dropdown is set to Per Pixel and adjust the Per Object Limit property.
    Keep in mind that increasing the above-mentioned values will result in extra draw calls.

    6.2.2 Adjust Render Mode property
    Figure 14. Light component in URP.

    For lights of high importance, set the Render Mode dropdown in the Light component to Important. This will reduce the probability of Unity converting said light to a vertex light.

    When Render Mode is set to Auto, Unity will check the light's intensity and its relative distance from the camera before converting it.

    Lights which have Render Mode set to Not Important will always revert to vertex lights.

    6.2.3 Switch rendering paths
    If you need many mixed or realtime lights in the scene, consider switching to a deferred rendering path. Here is how to do this:
    • In the Built-in render pipeline, navigate to Project Settings > Graphics. Under Tier Settings, uncheck the Use Defaults checkbox for the tier of your choosing. Set the Rendering Path dropdown to Deferred.
    • In URP, select the Render Pipeline Asset. Under the Rendering header, set the Rendering Path to Deferred.
    6.2.4 Switch to baked lights
    The easiest and most performant way to mitigate pixel light limitations is by switching to baked lights. To do so, set the Mode dropdown in the Light component to Baked.
    M_MG_S, zalogic and Ka92 like this.
  8. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 7: Mixed lights render as baked
    Figure 15. A simple scene containing nine mixed lights baked in Shadowmask mode. Notice that some spheres are unlit and appear as dark (left). Light Overlap debug view highlights overlapping lights in red (center). As shown in the Shadowmask debug view, lightmapper discards overlapping lights, and does not include them in the shadow mask texture (right).

    7.1 Why does this happen?
    When using Shadowmask lighting mode, only four mixed lights can overlap. Lights exceeding this limit will become baked lights.

    In Subtractive lighting mode, all lights – except for directional lights – will not cast realtime shadows. This is an inherent limitation of this lighting mode.

    7.2 How to fix it?
    7.2.1 Change light placement and radius
    To verify that light overlap is the issue, switch to Light Overlap scene view draw mode after generating lighting. This scene view draw mode will highlight overlapping lights in red.

    Move the affected lights so that they no longer overlap. Otherwise, adjust the Range or Spot Angle parameters in the Light component. Generate lighting again after making the changes.

    7.2.2 Switch to a different lighting mode
    Each lighting mode comes with its own advantages and limitations. If your project will be lit using a single directional light, then Subtractive lighting mode might be a better choice than Shadowmask. Please consult the Unity manual page on lighting modes to make the best decision for your project.
    M_MG_S and Ka92 like this.
  9. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 8: Unexpected environment lighting
    Figure 16. Expected result (left) versus the actual result in the standalone player build (right). This example uses realtime lighting. Notice that in the image on the right, shadows have a bluish tint to them. This is due to the SkyManager updating the ambient probe to match the default skybox color. This may or may not be a desired effect.

    8.1 Why does this happen?
    In the 2021.1 release, we introduced a change that allows Unity to update the default skybox and ambient probes automatically. This ensures that the realtime environment lighting remains accurate without having to rely on baked lighting.

    By default, this change might introduce ambient lighting to projects which either rely on custom environment shaders or need no ambient lighting at all.

    We are working on making this functionality more flexible in the future releases.

    8.2 How to fix it?
    8.2.1 Set environment color to black
    Setting the environment color to black disables SkyManager updates. Here is how to do this:
    • In the Built-in render pipeline and URP, navigate to Lighting > Environment > Environment Lighting. Set the Source to Color and change it to black. Or, set the Skybox Intensity value to zero.
    • In HDRP, add the Visual Environment override to the Volume component. Set the Sky Type property to None.
    8.2.2 Uncheck the Recalculate Environment Lighting toggle
    Figure 17. Toggle which disables SkyManager updates in the editor and in the standalone player builds.

    Navigate to Lighting > Workflow Settings and uncheck the Recalculate Environment Lighting toggle. Doing so will disable SkyManager updates both in the editor and the player. Please note that this is a global setting and will affect all scenes in your project.

    8.2.3 Uncheck the Auto Generate toggle

    Navigate to Window > Rendering > Lighting and uncheck the Auto Generate toggle. Remember to bake lighting by clicking on the Generate Lighting button.
    Auto Generate is meant for iterating on scene lighting. Having it always enabled is not recommended, and can lead to unexpected results.
    Last edited: Sep 29, 2022
  10. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 9: Lightmap UV artifacts
    Figure 18. Lightmapped objects exhibiting severe artifacts due to missing lightmap UVs (left). Same objects with correctly authored lightmap UVs (right).

    9.1 Why does this happen?
    Unlike regular texture UVs, lightmap UVs have different requirements:
    • It cannot contain any overlaps.
    • It must have enough padding between UV shells.
    • It should have minimal area and angle distortion.
    • It should be uniformly scaled.
    • It must be within the [0,1] UV space, and not exceed it.
    If lightmap UVs violate one or several of the points outlined above, the affected object will exhibit artifacts post-bake. They might appear as distortions over the surface of an object or as darkening around edges.

    9.2 How to fix it
    Note: to make the process of debugging easier, consider using UV Overlap and Baked Lightmap scene view draw modes.

    For more information, please refer to these pages in the Unity Documentation website:
    9.2.1 Generate lightmap UVs in Unity
    Figure 19. Lightmap UVs settings in the Mesh Importer window. This allows users to generate lightmap UVs automatically within the editor.

    Often, automatic lightmap UVs should be enough for lightmapping. Follow these steps to generate lightmap UVs in the editor:
    1. Select the model in your Project view. Unity opens the Model Import Settings in the Inspector.
    2. In the Model Import Settings, navigate to the Model tab, and then the Geometry section.
    3. Tick the Generate Lightmap UVs checkbox. The Lightmap UVs settings section appears below the Generate Lightmap UVs checkbox.
    4. Optional: Configure the settings in the Lightmap UVs settings section. See Settings for more information.
    5. Click the Apply button. Unity generates lightmap UVs into the Mesh.uv2 channel.
    In the 2020.1 release, we introduced Auto Pack Margin feature when generating lightmap UVs in Unity.

    9.2.2 Custom lightmap UVs
    Complex objects are good candidates for manually authored lightmap UVs. Please refer to your preferred DCC program documentation on how to use UV authoring tools.

    Note that you must place custom lightmap UVs in the second (UV1) channel.

    9.2.3 Increase lightmap resolution
    When working with lightmaps, use the lowest resolution possible that still achieves good looking results. In some cases, increasing lightmap resolution might be the simplest solution. Keep in mind that an increase in lightmap resolution will result in higher memory use and longer bake times.
    M_MG_S, zalogic and Ka92 like this.
  11. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 10: Lightmap UV seams
    Figure 20. Lightmap UV split visible across the hand after baking (left). Unity fixes seams after enabling the Stitch Seams option and baking again (right).

    10.1 Why does this happen?
    By default, GPUs cannot blend color values between separate UV shells. Without the extra post processing step, this limitation can cause visible seams to appear in a lightmap. Aggressive filtering and low lightmap resolution can exacerbate this problem by bleeding texel color values into neighboring UV shells.

    10.2 How to fix it
    Disclaimer: fixing lightmap seams in a single object can be trivial. It is more difficult to address this problem when working with modular meshes. This is a common issue that most lightmapping backends face, and it is a hard problem to solve.

    10.2.1 Enable Stitch Seams option
    Stitch Seams option is available in the Mesh Renderer component, under the Lightmapping header. By enabling it, Unity will attempt to fix seams by blending color values between UV shells that share a stitchable common edge in the model.

    Note that this option only works with single GameObjects. Multiple GameObjects are not supported.

    10.2.2 Combine meshes in a DCC tool
    Figure 21. Cornell Box scene assembled using modular meshes with visible seams after lightmap baking (left). Meshes combined in a DCC tool prior to exporting with no lightmap seams visible (right). You can achieve the result on the right by disabling filtering and baking with high sample counts.

    The easiest way to mitigate seams is to combine meshes in a 3D modeling package. Make sure to weld overlapping vertices before exporting. Or, you can weld vertices in in the Model Import Settings window. Skipping this step might impede automatic lightmap unwrapping in Unity.

    10.2.3 Combine meshes via an API
    Mesh.CombineMeshes method combines meshes into one, achieving the same result as merging them in a DCC package.

    10.2.4 Combine meshes using ProBuilder
    When working with ProBuilder meshes it is possible to merge multiple objects by using the Merge Objects option.

    You can make this option available for regular meshes by converting them into ProBuilder meshes using the ProBuilderize option.

    10.2.5 Disable filtering and denoising
    By disabling filtering, it is possible to avoid blurring and dilation issues described earlier. The main drawback of this approach is long bake times, as you would need to increase the number of samples to achieve clean results.

    10.2.6 Increase lightmap padding
    If disabling filtering does not solve the issue, try increasing Lightmap Padding value. When working with modular meshes, each mesh has its own UV atlas. Lightmap Padding property allows you to change the distance between UV atlases – but not between UV shells within the atlas - to prevent leaking.

    10.2.7 Use light probes
    Light probes are often used to provide indirect illumination for dynamic objects. Consider utilizing light probes for difficult to lightmap objects.

    It is worth mentioning that probe-lit objects receive lighting information from a single probe. It can be detrimental when illuminating large objects. Light Probe Proxy Volume (LPPV) component can mitigate this problem, by creating a grid of light probes within a bounding volume. As a result, probe-lit objects that make use of LPPVs have a spatial gradient improving their look.

    Adaptive probe volumes allow for per-pixel lighting and streamlined placement when compared to light probe groups, and LPPVs.

    10.2.8 Hide seams using meshes or textures
    If the art direction allows for it, try using trim meshes to hide seams between objects. This is a commonly used technique in game development.
    M_MG_S, zalogic and Ka92 like this.
  12. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 11: Blurry lightmaps
    Figure 22. Cornell Box scene baked at 8 texels per unit resolution (left). Same scene baked at 32 texels per unit resolution (right). Notice the increased shadow fidelity in the statue, and the lack of light leaking in the tall box.

    11.1 Why does this happen?
    To ensure high fidelity output, Unity needs a high resolution lightmap to capture lighting information. Too few texels and the result will be blurry.

    Also, lightmap texels must be uniform, square in shape. Non-uniformly scaled lightmap UVs will appear stretched post-bake.

    11.2 How to fix it?
    11.2.1 Adjust lightmap resolution
    There are two ways to adjust lightmap resolution:
    • Globally. Use the Lightmap Resolution property in the Lighting window to adjust lightmap resolution for all objects in the scene.
    • Per-object. Adjust the Scale In Lightmap parameter found in the Mesh Renderer component. This parameter is a multiplier of the Lightmap Resolution property found in the Lighting window.
    Note that a two times increase in lightmap resolution will result in four times increase in baking times. High resolution lightmaps will also lead to higher memory usage.

    Keep a low lightmap resolution for:
    • Surfaces that receive uniform lighting
    • Surfaces that receive indirect lighting only
    • Small objects
    • Surfaces that are not visible to the player
    Reserve high lightmap resolution for:
    • Areas of high importance
    • Surfaces which receive baked direct lighting and shadows
    11.2.2 Adjust Max Lightmap Size property
    Max Lightmap Size will be the limiting factor to the final lightmap resolution. This is especially true for large objects, such as terrains. Increase Max Lightmap Size property in the Lighting window if:
    • Objects start to exceed maximum space in the lightmap atlas
    • The number of low resolution lightmaps after baking is high, even after increasing lightmap resolution
    11.2.3 Maintain uniform lightmap UV scale
    Figure 23. Lightmap texels stretched horizontally resulting in distorted output (left). Uniformly scaled lightmap texels (right). Both lightmaps have the same 80 texels per unit resolution.

    Lightmap texels should remain in a uniform scale. This will prevent lightmap distortions. To ensure this, keep in mind the following:
    • When authoring custom lightmap UVs, do not scale UV shells in one axis only. If you need to scale UV shells, do so uniformly, across all axes.
    • When scaling UV shells, scale an entire atlas. Avoid scaling single shells unless it is necessary.
    • Same logic applies to GameObjects in the editor. Try to keep them uniformly scaled. Scaling objects in one axis will stretch lightmap UVs as well.
    Use Baked Lightmap scene view draw mode to inspect lightmap uniformity. Remember to enable the Show Lightmap Resolution checkbox to see lightmap texels.
    Last edited: Apr 25, 2023
    M_MG_S, zalogic and Ka92 like this.
  13. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 12: Lightmap aliasing
    Figure 24. Baked shadows with lightmap super-sampling disabled (left). Same scene with 4x super-sampling (right).

    12.1 Why does this happen?
    Aliasing is a visual artifact which appears when lightmap resolution is too low. It manifests itself as a stair-stepping effect around edges. It is common when using baked direct lighting in high contrast areas.

    12.2 How to fix it?
    12.2.1 Tweak the Anti-aliasing Samples property
    Figure 25. Lightmap Parameters Asset with the super-sampling property highlighted.

    You can find the Anti-aliasing Samples property in the Lightmap Parameters Asset. Anti-aliasing attempts to fix aliasing artifacts by super-sampling texels. More samples will result in smoother results. Available options are:
    • Off. Set the value to any integer in the 1 to 3 range.
    • 2x super-sampling. Set the value to any integer in the 4 to 8 range. This is the default value.
    • 4x super-sampling. Set the value to any integer in the 9 to 256 range.
    Higher super-sampling values will result in higher memory consumption while baking and slower bake times. It has no negative impact on memory consumption post-bake.

    12.2.2 Use Baked Shadow Angle
    Figure 26. Baked shadows with lightmap super-sampling disabled (left). Same scene with the Baked Shadow Angle property set to 0.5 for the Directional Light (right).

    Baked Shadow Angle property adjusts the amount of shadow scattering for baked lights. Adjust this property to taste for added realism. This also has an added benefit of smoothing out jaggies in lightmaps. This property is available for most lights in the Light component.

    Keep in mind that high Baked Shadow Angle only affects fully Baked lights. It has no effect on Mixed, and Realtime lights. To get smooth results, you would need to increase the number of Direct Samples used for baking.

    12.2.3 Use Gaussian filtering
    Figure 27. Baked shadows with lightmap super-sampling disabled (left). Same scene with the Gaussian filter radius set to 1 texel (right).

    You can access the Gaussian filter in the Lighting window by setting the Filtering dropdown to Advanced. Adjust the Direct Filter radius slider to blur aliased edges.

    Note: in Unity 2022.2 and 2023.1 releases we have increased Gaussian filter precision to 0.1 texel radius for finer control.
  14. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 13: Direct, indirect, and environment noise
    Figure 28. All sample counts are set to 8 (left). All sample counts are set to 2048 (right).

    13.1 Why does this happen?
    Progressive Lightmapper is a Monte Carlo path tracer. To achieve clean results, lightmapper needs to spawn many rays from each lightmap texel. Insufficient ray counts will lead to noisy lightmaps.

    13.2 How to fix it?
    Note: to make the process of debugging easier, in the Lighting window, set the Filtering property to None.

    Increasing the number of samples will reduce lightmap noise. It will increase bake times in a linear fashion.

    There are three types of sample counts: direct, indirect, and environment.

    13.2.1 Increase direct samples
    Figure 29. Scene lit only by direct light. Direct samples are set to 8 (left). Direct samples are set to 2048 (right).

    Direct samples control the number of rays, which the lightmapper shoots towards light sources.

    Increase Direct Samples if:
    • Objects lit by area lights produce noisy soft shadows.
    • Baked lights with a modified Baked Shadow Angle value produce noisy results.
    13.2.2 Increase indirect samples
    Figure 30. Scene lit only by the indirect bounce light. Indirect samples are set to 8 (left). Indirect samples are set to 2048 (right).

    Indirect samples control the number of paths, which the lightmapper shoots towards the GI contributors in the scene. Once they intersect geometry, texels spawn rays towards:
    • Environment, which makes it an indirect environment sample.
    • A light source, which makes it an indirect lighting sample.
    Paths can bounce off surfaces. There are a few ways Unity can end a path:
    • Once it reaches the Max Bounces value.
    • If it does not intersect any geometry.
    • By the Russian roulette algorithm.
    Increase Indirect Samples if:
    • Indirectly lit areas are noisy.
    • Objects using emissive materials produce a lot of noise.
    13.2.3 Increase environment samples
    Figure 31. Scene lit only by environment lighting. Environment samples are set to 8 (left). Environment samples are set to 2048 (right).

    Environment samples control the number of rays, which the lightmapper shoots towards the sky/environment.

    Increase Environment Samples if:
    • Baked environment/HDRI produces noisy results.
    • Note that you would need to disable all lights in the scene to verify this.
    13.2.4 Use denoising and filtering
    Achieving pristine lightmaps without using filtering would need tens of thousands of samples. Unity can apply a post-processing step to remove noise by using filtering or machine learning denoisers. To enable filtering, navigate to the Lighting window (Window > Rendering > Lighting) and select the Filtering property. There are three options:
    • None. Disables filtering and denoising.
    • Auto. Attempts to select the best filtering and denoising option based on current system configuration.
    • Advanced. Allows users to fine-tune filtering and denoising properties.
    Here are the available filters:
    • Gaussian. Applies a bilateral filter (blur) to the lightmap. This may smooth-out noise, at the expense of visual fidelity. Increase radius parameters to increase filtering strength. High values can lead to leaking artifacts.
    • A-Trous. Edge-aware filter which attempts to remove noise, while maintaining edge definition. Works well with high sample counts and in conjunction with denoising. Does not work well with noisy HDR lightmaps.
    Here are the available machine learning denoisers:
    • Open Image Denoise (OIDN). Machine learning denoiser from Intel. Vendor agnostic. Works on Windows, macOS, and Linux platforms.
    • Optix. Machine learning denoiser from Nvidia. Works only with Nvidia GPUs. Supports Windows only.
    • RadeonPro. Machine learning denoiser from AMD. Vendor agnostic. Works on Windows and Linux.
    For best results, experiment with different denoiser and filtering combinations.
    M_MG_S, zalogic and Ka92 like this.
  15. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 14: Fireflies
    Figure 32. Fireflies caused by a bright light source placed close to scene geometry. Even at 4K indirect samples the noise is visible (left). Baking with 16K indirect samples and Open Image Denoiser enabled removes the noise.

    14.1 Why does this happen?
    Small, high luminosity areas in the lightmap cause fireflies to appear. Such areas are easy to miss when spawning rays from texels. When rays intersect those high intensity areas, they skew the average luminosity estimate. This results in speckled noise often referred to as “fireflies”.

    14.2 How to fix it?
    Note: we are planning on addressing this issue for punctual lights in the future with the splat clamping feature. The importance sampling feature already addresses this issue for HDRIs.

    14.2.1 Increase sample counts
    This is a brute force method. To achieve acceptable results, you would need to use 4K indirect samples, or more, in conjunction with filtering and denoising.

    14.2.2 Enable importance sampling
    Figure 33. Fireflies caused by the high frequency HDRI (left). Same scene after enabling the Importance Sampling toggle (center). High frequency cubemap used to illuminate the scene (right).
    Figure 34. Enabling Importance Sampling can introduce noise when using low frequency HDRIs. Importance Sampling disabled (left). Importance Sampling enabled (center). Low frequency cubemaps used to illuminate the scene (right).

    Importance sampling analyzes the environment map and finds areas of high intensity in it.

    Enable importance sampling if:
    • You are using a high frequency HDRI image for environment lighting. An example of this would be an HDRI with a bright sunspot in the horizon.
    Disable importance sampling if:
    • You are using a low frequency HDRI image for environment lighting. An example of this would be an overcast HDRI or a solid color skybox.
    Enabling importance sampling when using low frequency HDRIs can result in increased noise levels.

    14.2.3 Enable filtering and denoising
    Fireflies are challenging to remove even when using ML denoisers in conjunction with filtering. To get clean results, you would still need to use high sample counts.

    14.2.4 Avoid small baked emissive objects
    When using emissive materials, consider setting the Global Illumination property to None in the Material Inspector. The object will keep its self-illuminating appearance, but it will not contribute to global illumination. This may reduce noise.

    14.2.5 Move baked lights away from static geometry
    URP and HDRP use inverse square falloff for lights by default. In the Built-in render pipeline, you can achieve the same effect by using custom falloff scripts. The unfortunate side effect being that such lights might lead to increased noise levels when placed very close to static geometry. Ensure that there is enough distance between the static geometry and the lights in the scene.
    M_MG_S, zalogic and Ka92 like this.
  16. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 15: Invalid texel artifacts
    Figure 35. Scene containing a one-sided curtain mesh which causes invalid texel artifacts to appear after baking (left). Texel Validity scene view mode highlights invalid texels in red (right). Notice how saturated invalid texels are around the curtain area.

    15.1 Why does this happen?
    Sometimes, invalid texels can be the cause of blocky artifacts in a lightmap.

    Unity can mark Lightmap texels as invalid under the following circumstances:
    • When a given texel has not received any illumination via direct, indirect, or environment samples.
    • Rays originating from a texel have intersected back-facing surfaces.
    Lightmap filtering and denoising can make this issue worse by spreading invalid texels to neighboring texels. That is why it is important to address this issue early on without relying on post processing.

    15.2 How to fix it?
    Note: to make the process of debugging easier, consider using Texel Validity scene view draw mode.

    15.2.1 Adjust mesh normals
    Figure 36. Cube in the center has all its vertex normals facing outwards, resulting in a seamless and correctly shaded mesh. Blue polygons in the cube on the left are flipped. Orange polygons in the cube on the right are flipped. Cubes on the left and right will both exhibit invalid texel artifacts after baking, whereas the one in the center will not.

    Vertex normal direction determines which side of the polygon appears as the front (visible) side. Flipping the direction of the normal will render the face invisible unless you are using double-sided shaders. Always ensure that the polygons, which you want to be visible, have their normals pointing outwards.

    Most 3D modeling applications generate correct normals automatically. There are times when you would need to adjust mesh normals manually. To do so, please refer to 3ds Max, Maya, Blender, or other 3D modeling package documentation of your choice.

    15.2.2 Avoid open faces
    In some cases, adjusting normals might not be enough. For more complex meshes, make sure that they are watertight before exporting:
    • Cap all open faces.
    • Weld all overlapping vertices.
    • Avoid line and point geometry.
    • Avoid floating geometry unless your use case requires it.
    Ignoring the above-stated suggestions might result in invalid texel artifacts when baking. In 3ds Max, try using xView to help identify mesh issues. Refer to documentation articles on how to do this in other 3D modeling applications.

    15.2.3 Enable the Double-Sided Global Illumination material property
    Figure 37. We have enabled Double Sided Global Illumination for the curtain mesh which before caused invalid texels to appear (left). Texel Validity view no longer shows any invalid texels in red around the curtains (right). Notice that not only the artifacts are gone, but the light also bounces off curtains.

    Figure 38. Material inspector in different render pipelines. Built-in render pipeline (left), URP (center), and HDRP (right). We have highlighted the properties related to Double Sided Global Illumination in blue.

    Foliage, decals, and other thin one-sided meshes often do not benefit from the steps outlined above. In such cases, the easiest way to fix texel validity artifacts is by enabling Double Sided Global Illumination material property. Once enabled, the lightmapper treats back-facing polygons as front-facing polygons during lightmap baking.

    To make use of double-sided GI, follow these steps:
    • In the Built-in render pipeline, enable Double Sided Global Illumination checkbox in the Material Inspector. Same steps apply to custom ShaderGraph materials as well.
    • In URP, set the Render Face dropdown to Both. You can find this property under the Surface category in the Lit Shader.
    • In HDRP, two properties located under the Surface category in the Lit Shader control the double-sided GI behavior:
      • Double-Sided. Enable this checkbox to disable backface culling. This also enables double-sided GI.
      • Double-Sided GI. This dropdown contains three options: Auto, On, and Off. When Auto is selected, double-sided GI is enabled if Double-Sided property is also enabled. On and Off options allow to override double-sided GI behavior without making material appear double-sided.
      • You can also control double-sided GI material property via the API.
    15.2.4 Why not always enable Double-Sided Global Illumination property?
    Figure 39. Double Sided Global Illumination disabled (left) and enabled (right). Notice dark artifacts where the meshes intersect in the image on the right. In such cases, disable Double Sided Global Illumination to achieve correct output.

    Lightmapper marks texels as invalid when they receive no illumination or intersect backfaces. This allows the dilation filter to push lighting data from valid surrounding texels into partially covered texels. Doing so helps to remove dark artifacts at geometry junctions.

    Enabling double sided GI by default for all materials, would result in a darkening effect where meshes intersect or overlap.

    Please use this setting at your own discretion where it makes sense.

    15.2.5 Adjust the Backface Tolerance property
    You can access the Backface Tolerance property via the Lightmap Parameters Asset. Create a new lightmap parameters asset and assign it via the Mesh Renderer component, under the Lightmapping section.

    This property controls the percentage of rays that must hit front-facing geometry to consider the texel valid:
    • Increasing the value increases the likelihood the lightmapper marks a texel as invalid when it sees backfaces.
    • Lowering this value will reduce the number of invalidated texels.
    Note that low values might result in a loss of occlusion and/or bounce lighting, thus changing the look of the scene.

    15.2.6 Move meshes closer to the world origin
    Note: we are planning on addressing this issue in the future by implementing 64-bit floating-point precision support for the unified lightmapping backend.

    Limitations imposed by the 32-bit floating-point precision format can be the cause of invalid texels. It happens when placing lightmapped meshes far away from the world origin (0,0,0), or if they have a massive scale. This issue is not limited to lightmapped meshes; objects and animations will lose precision the farther away they are from world origin.

    To resolve this issue, move meshes closer to the 0,0,0 world coordinate. Or, try adjusting the Push off value in the Lightmap Parameters Asset.

    For more information, please refer to the excellent article on floating-point arithmetic by Alan Zucconi.
    Last edited: Jul 27, 2023
  17. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 16: Denoising artifacts
    Figure 41. Scene lit by an emissive object placed outside the door. Severe artifacts are visible when all sample counts are set to 32 with the Open Image Denoiser enabled (left). The image is cleaner with all sample counts set to 2K and with the Open Image Denoiser enabled (right).

    16.1 Why does this happen?
    Machine learning denoisers are effective at removing noise, but can still struggle under certain circumstances:
    • In particularly noisy scenes, especially when there is a lot of speckle noise (fireflies).
    • With thin geometry and at edge intersections due to dilation.
    • When using high intensity light sources which need HDR lightmaps.
    • When there is not enough training data to denoise the scene.
    Artifacts often appear as smears, smudges, or as ringing around edges. Sometimes, denoisers can produce black lightmaps, or fail to denoise the scene, thus leaving the noise intact.

    16.2 How to fix it?
    16.2.1 Increase sample count
    Figure 42. RMSE graph from Enter the Room project. This graph measures how different filtering and denoiser methods perform when compared against the ground truth image. Both Optix and OIDN graphs show good results after the 256-sample mark. Note that the results will differ across projects.

    The easiest way to improve denoising performance is to increase the number of samples. In most cases, indirect noise will be the largest culprit for poor denoising performance.

    Most denoisers perform well at 256 samples and higher. For more information on the subject, please watch the following GDC 2019 presentation: Intel Open Image Denoise in Unity: Open Source Denoising for Lightmaps (Presented by Unity and Intel)

    16.2.2 Try a different denoiser
    Some denoisers might perform better under certain circumstances. To choose a different denoiser, set the Filtering property to Advanced. This will allow you to specify which denoiser to use for direct, indirect, and ambient occlusion buffers.

    16.2.3 Use Gaussian or A-Trous filters
    If denoising does not yield the result you are looking for, you can try using Gaussian or A-Trous filters instead. To specify which filter you want to use, set the Filtering property to Advanced. You can use filters in conjunction with machine learning denoisers.
  18. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 17: Filtering artifacts
    Figure 43. Scene filtered using Gaussian filter at a 1 texel radius. With all samples set to 32, the final lightmap exhibits splotches (left). Baking with all samples set to 2K and with Gaussian filtering enabled yields better results (right).
    Figure 44. Scene filtered using A-Trous filter. With all samples set to 32, A-Trous edge preservation algorithm cannot distinguish between noise and edges, and thus completely fails (left). After increasing all samples to 2K, A-Trous filter yields decent results, with less blurring when compared to Gaussian (right).

    17.1 Why does this happen?
    Gaussian and A-Trous filters both differ in terms of functionality, and the artifacts they can introduce tend to be different as well.

    Artifacts associated with aggressive Gaussian filter settings:
    • Light and/or shadows leaking through geometry.
    • Blurry results.
    • Splotchy lightmaps.
    Artifacts associated with the A-Trous filter:
    • Speckled noise at low sample count.
    • Failure to denoise HDR lightmaps (noise interpreted as edges).
    17.2 How to fix it?
    17.2.1 Increase sample count
    As was the case with denoisers, increasing sample counts will improve filtering performance as well.

    17.2.2 Use a machine learning denoiser
    Denoisers are more effective at removing noise than filters and have less bias. It is also possible to use filtering in conjunction with denoising. A-Trous works well with machine learning denoisers. The Gaussian filter works well too, albeit at a low radius.

    17.2.3 Tweak filtering settings
    Unlike denoisers, both Gaussian and A-Trous filters allow you to tweak the strength of the filtering applied. You can do this by adjusting radius and sigma values. If your scene suffers from lightmap leaking artifacts, or over blurring, try reducing the Gaussian filter radius value. This will reduce the amount of bi-lateral blurring and will prevent texel smearing.
    M_MG_S and zalogic like this.
  19. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 18: Lightmap leaking
    Figure 45. Lightmap leaking introduced by aggressive Gaussian filtering settings and poor object placement (left). Open Image Denoiser mitigates leaks, but not entirely (center). Adjusting the Y-coordinate of the affected props so that they do not intersect scene geometry fixes the issue entirely (right).

    18.1 Why does this happen?
    Lightmap leaks occur when a single lightmap texel occupies lit and shadowed areas at the same time. This causes the baked light to “leak” into surrounding texels, causing a noticeable difference in lighting. It is common to see this artifact in dimly lit indoor areas, with a bright light outdoors.

    18.2 How to fix it?
    18.2.1 Adjust lightmap UVs and resolution
    Increasing Lightmap Resolution can help with texel coverage and thus reduce light leaking.

    If increasing the resolution is not possible, you would need to change lightmap UVs in a DCC tool. Split the lightmap UV chart at the seam between light and dark areas. This will prevent lighting from bleeding into surrounding texels. Make sure that there is enough padding between charts to minimize leaks.

    18.2.2 Adjust filtering settings
    Aggressive Gaussian filter settings can introduce light leaks. Please refer to the filtering artifacts section on how to fix this.

    18.2.3 Adjust scene geometry
    In many instances, light leaking might not be a byproduct of aggressive filtering, but rather of suboptimal object placement. Make sure that your objects do not intersect or stick out through the scene geometry. For interior scenes, avoid using one-sided wall meshes if possible; opt for extruded meshes instead.
    M_MG_S, zalogic and Ka92 like this.
  20. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 19: Compression artifacts
    Figure 46. Banding artifacts introduced by low quality compression on Android platform (left). You can fix banding artifacts by using high quality compression (right).

    19.1 Why does this happen?
    Color banding and blocky artifacts are often associated with low quality texture compression. Unity attempts to automatically select the best compression format for the target platform. Due to compatibility concerns, texture formats intended for mobile platforms are often more affected by compression artifacts.

    19.2 How to fix it?
    19.2.1 Change Lightmap Encoding setting
    Figure 47. Project Settings window. We have highlighted the Lightmap Encoding dropdown in blue. You can find the HDR Cubemap Encoding setting underneath.

    Lightmap Encoding setting determines how Unity encodes High Dynamic Range (HDR) lightmaps. You can access it in Project Settings > Player > Other Settings. Higher quality tiers provide better results. You need to adjust this setting for each platform.

    19.2.2 Change HDR Cubemap Encoding setting
    In the 2022.1 release, we introduced a HDR Cubemap Encoding setting in the Project Settings window. This property is almost identical to the Lightmap Encoding setting, but it controls the encoding of the cubemaps instead of lightmaps.

    If reflective objects in your scene exhibit artifacts, switch to a higher quality preset for the affected target platform.

    19.2.3 Change Lightmap Compression property
    Figure 48. Lightmap Compression property in the Lighting window.

    Lightmap Encoding influences how Unity encodes lightmaps. Lightmap Compression dropdown in the Lighting window determines the actual compression quality. There are four options: None, Low Quality, Normal Quality, High Quality. Higher quality presets will result in less compression artifacts post-bake.

    19.2.4 Override texture format manually
    Figure 49. Texture Importer window allows users to manually override texture compression format.

    It is possible to override lightmap compression format manually via the Texture Importer. To do this, follow these steps:
    1. In the Project window, navigate to the folder which contains the lightmap textures.
    2. Select one of the lightmap textures.
    3. In the Inspector window, scroll all the way to the bottom, and click on one of the tabs representing each installed platform.
    4. Enable the checkbox to override the texture format for the platform of your choice.
    5. Select the desired format and click Apply.
    It is worth noting that your customizations will be overwritten every time you generate lighting. Follow the above-mentioned steps again after baking.
    M_MG_S, zalogic and Ka92 like this.
  21. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 20: Light probe ringing artifacts
    Figure 50. Remove Ringing disabled (left) and enabled (right). Notice how negative light probe values result in wrong shading for the statue on the left. You can fix this issue by enabling the Remove ringing option, but as a result, the final output can appear very smooth.

    20.1 Why does this happen?
    When intense light hits a light probe, the light signal does not decay across its surface. Instead, it ripples through the light probe, like a wave. As a result, the affected part of the probe will store negative light values. This phenomenon manifests itself as a ringing artifact which will result in wrong lighting.

    20.2 How to fix it?
    Note: to make the process of debugging easier, enable Gizmos in the Scene viewport. Also, adjust the Light Probe Visualization property to your preference in the Workflow Settings.

    20.2.1 Enable Remove Ringing option
    You can find the Remove Ringing property in the Light Probe Group component. It is enabled by default for newly created light probe groups. This feature analyzes light probes, and skews the signals stored in them, so that ringing artifacts disappear.

    If light probes, and probe-lit objects in your scene exhibit ringing artifacts, please enable the Remove Ringing option.

    It is important to note that light probe de-ringing will introduce some amount of blurring to light probes. This will cause probe-lit objects to lose some contrast. Disable Remove Ringing option if light probes in your scene do not exhibit ringing artifacts.

    20.2.2 Change scene lighting
    Intense baked direct lighting can cause ringing artifacts in light probes. If your art direction allows for it, try reducing Intensity value in the Light component.

    Or, make use of mixed lights. They provide realtime direct and baked indirect contribution. Light probes will still capture indirect lighting data which is less prone to ringing.
    Last edited: Oct 1, 2022
    M_MG_S, zalogic and Ka92 like this.
  22. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 21: Light probe leaking
    Figure 51. Cornell Box scene placed in a bright outdoor environment. Due to a sparse light probe network, probe-lit statue samples a light probe outside, which makes it appear bright (left). Increasing the density of the light probe network fixes the issue (right).

    21.1 Why does this happen?
    Light probe leaking occurs when a probe from a brightly lit area affects an object in a dimly lit area, and vice-versa. As a result, probe-lit objects will appear out of place, looking either too bright or too dark in their surrounding environment.

    21.2 How to fix it?
    21.2.1 Increase light probe density
    Increasing the number of light probes around the affected object is the easiest way to prevent leaking. Or, if the problem is most evident around walls, try placing dense probe clusters alongside them. Even a buffer of two probes at each side of the wall will help reduce leaking.

    To place light probes, click on the Edit Light Probes button in the Light Probe Group component.

    21.2.2 Use Anchor Override
    Figure 52. Anchor Override property in the Mesh Renderer component.

    By default, Unity uses the center point of the GameObject’s bounding box to determine which light probes to sample. As seen in the earlier example, this might lead to issues, especially with sparse probe networks.

    It is possible to change this behavior by using the Anchor Override property in the Mesh Renderer component. Light probes will use transforms of the GameObject assigned to that field for lighting. You can use existing objects or create new ones to act as anchor points. Empty GameObjects will work, too.

    21.2.3 Use Light Probe Proxy Volumes
    Light Probe Proxy Volume component places light probes at a user-defined density within the bounding box of the GameObject. Keep in mind that LPPVs have a runtime cost associated with them, so use them sparingly.
    M_MG_S and zalogic like this.
  23. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 22: Light probe noise
    Figure 53. Enter The Room scene lit by a multi-colored emissive object. When Light Probe Sample Multiplier is set to 1, light probes are not homogenous (left). Increasing Light Probe Sample Multiplier to 32 mitigates the issue (right). Apart from the change to the sample multiplier, both images were lit using identical lighting settings.

    22.1 Why does this happen?
    In scenes with a lot of indirect noise, probe-lit objects can exhibit flickering as they traverse through the environment. Inadequate sample counts used by probes is the culprit. As a result, adjacent light probes will appear to have varying lighting information, when they should appear as homogenous.

    This applies to Light Probe Groups and Adaptive Probe Volumes.

    22.2 How to fix it?
    22.2.1 Tweak the Light Probe Sample Multiplier
    Light Probe Sample Multiplier acts as a general multiplier for Direct, Indirect, and Environment sample counts. The higher the multiplier, the more samples light probes will receive. This will improve their visual quality at a slight expense of baking time.

    If the Light Probe Sample Multiplier property is not available in the Lighting window, navigate to Project Settings > Editor > Graphics. Uncheck the Use legacy Light Probe sample counts checkbox.
    Last edited: Feb 3, 2023
  24. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 23: Redundant light probes
    Figure 54. Screenshot from the Adventure Sample Game. Scene still contains light probes from an unloaded scene (left). Calling the LightProbes.TetrahedralizeAsync removes the redundant light probes upon loading a new scene (right).

    23.1 Why does this happen?
    Unity uses tetrahedral space mapping to determine which light probes to use for illuminating dynamic GameObjects. When loading and unloading scenes containing light probes, it is important to recalculate the tetrahedral mapping. Failure to do so will result in incorrect shading for probe-lit objects.

    23.2 How to fix it?
    23.2.1 Recalculate probe tetrahedra using the API
    You can use LightProbes.Tetrahedralize to recalculate light probe tetrahedra after loading and unloading scenes. Wait for the LightProbes.needsRetetrahedralization event to finish before making the API call. Upon successful execution, Unity will reintegrate additively loaded probes into the tetrahedral structure, and will remove the unloaded probes.

    23.2.2 Adjust level design
    Figure 55. Screenshot from the Additive Loading Lighting Examples project. This example consists of three scenes: one containing the green corridor (Scene A), another one with the blue room (Persistent Scene), and the last one housing the red corridor (Scene B). We built it in such a way that light probes overlap in the blue room only. This ensures a seamless lighting transition when loading and unloading scenes.

    To avoid issues with redundant or overlapping probes, some adjustments to level design and additive loading approach might be necessary.

    In the example above, the project setup ensures that there will be a seamless lighting transition when moving between the scenes. Here is how we built this example project:
    • Persistent Scene which contains a blue room, and some probe-lit objects. It contains no light probes. This scene is always loaded and will act as a transitional area.
    • Scene A which contains a green corridor, and some probe-lit objects. It contains a light probe group that envelops Scene A and the Persistent Scene. This scene is additively loaded on demand.
    • Scene B which contains a red corridor, and some probe-lit objects. It contains a light probe group that envelops Scene B and the Persistent Scene. This scene is additively loaded on demand.
    To learn more about additive lighting, please check out the Additive Loading Lighting Examples project in the Asset Store.
  25. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 24: Optimize lighting settings for bake performance
    24.1 Realtime Global Illumination
    Impact: high. Enabling this checkbox enables Enlighten realtime global illumination. Not only does it increase baking times, but also incurs a runtime cost.

    Do not enable this checkbox unless you need realtime global illumination in your scene or have a specific use case necessitating both realtime and baked global illumination.

    24.2 Baked Global Illumination
    Impact: high. Enabling this checkbox enables baked global illumination using the Progressive Lightmapper. It increases baking times but incurs minimal runtime cost.

    Do not enable this checkbox if you are already using realtime global illumination.

    24.3 Lighting Mode
    Impact: low. This dropdown contains three properties: Baked Indirect, Subtractive, and Shadowmask. None of which have a major impact on baking performance. All three incur a runtime cost, Shadowmask being the least performant, Subtractive being the most performant, and Baked Indirect being somewhere in-between.

    When selecting Shadowmask, Unity will generate an extra texture known as shadow mask. This will not increase bake times but will increase memory requirements.

    24.4 Progressive Updates
    Impact: medium. When you enable the Progressive Updates, Progressive Lightmapper will process all lightmaps that are currently in view. Scenes containing many lightmaps will bake slower as a result.

    Enable this checkbox while iterating on your lighting. Disable it for final quality bakes.

    24.5 Importance Sampling
    Impact: low. Reduces noise when using high contrast HDRIs. Disable this checkbox if you use low contrast environment lighting.

    24.6 Direct Samples
    Impact: high. Controls how many rays the lightmapper shoots towards light sources. Keep this value low, unless soft shadows in your scene are noisy.

    24.7 Indirect Samples
    Impact: high. Controls how many paths a texel can spawn. The Max Bounces value acts as a modifier. Keep this value low, unless indirectly lit areas are noisy, and emissive objects produce a lot of noise.

    24.8 Environment Samples
    Impact: medium. Controls how many rays the lightmapper shoots towards the environment. Keep this value low, unless areas lit by the environment are noisy.

    24.9 Light Probe Sample Multiplier
    Impact: low. Improves the quality of lighting data stored within light probes. Stop increasing this value once the adjacent probes are somewhat homogenous in color.

    24.10 Max Bounces
    Impact: high. Determines the maximum number of steps (bounces) each path can take. Will increase bake times linearly.

    24.11 Filtering
    Impact: medium. Enables users to reduce noise using discrete filters or AI-powered denoisers. Impact on baking performance varies depending on the filtering and denoising combination used.

    Set this dropdown to None for the fastest iteration speed and troubleshooting. Enable filtering for production quality bakes.

    24.12 Lightmap Resolution
    Impact: high. Increases bake times in a quadratic fashion. In other words, increasing the resolution from 1 to 2 will increase the bake times by four times. It is important to keep this value as low as possible.

    The Occupied Texels string at the bottom of the Lighting window reports the number of texels Progressive Lightmapper needs to process. One million texels should still be very fast, but iteration times will suffer at eight million and higher.

    24.13 Anti-aliasing Samples
    Impact: high. This value is accessible via the Lightmap Parameters Asset. It impacts the memory used during the bake, as well as the bake preparation time, and the total bake time.

    Keep this value low - or disable it - unless your baked shadows suffer from stair-stepping artifacts (aliasing).
  26. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Chapter 25: Optimize scene setup for bake performance
    25.1 Probe-lit vs. lightmapped objects
    Figure 56. Screenshot from the Lighting Optimization Tutorial (left). GI Contributors scene view mode shows lightmapped objects (blue), objects that contribute GI, and receive lighting from light probes (red), and objects that do not contribute to GI, but receive lighting from light probes (yellow).

    Keeping the amount of occupied texels low is beneficial to bake times and the number of lightmaps. One way to achieve this is by keeping lightmap resolution down. In some cases, a better solution would be to rely on light probes for lighting. Probe-lit objects will not occupy space in the lightmap atlas but can still influence the global illumination if the user chooses to.

    Lightmap objects which will contribute to GI in a major way. Objects such as terrain, buildings, and other large meshes, are ideal for lightmapping. Objects such as fences, pebbles, wires, and other small props are excellent candidates for probe lighting.

    Dynamic objects will sample light probes by default but will not contribute to surrounding lightmaps. If you want probe-lit objects to cast baked shadows, and influence the GI, check the Contribute Global Illumination flag in the Mesh Renderer component. Receive Global Illumination dropdown should be then set to Light Probes.

    25.2 Non-visible geometry
    Do not lightmap objects that the player will not see. Lightmapper still takes such geometry into account during the baking process. This will increase bake times and lightmap occupancy.

    25.3 LODs
    We are planning on improving this workflow in the future by introducing a lightmap projection feature.

    It is not recommended to lightmap objects in every layer of the LOD Group. Doing so will increase bake times. Instead, consider lightmapping objects in the LOD0 layer, and using light probes for the lower layers. This will improve bake times and reduce lightmap occupancy. In most cases, the transition between lightmapped and probe-lit LODs should not be noticeable.

    25.4 Light grid
    Light grid is a three-dimensional grid which envelops static scene geometry and baked lights. It checks the number of lights in each cell which will affect the nearby texels.

    Progressive GPU lightmapper uses a dense light grid which it scans through very fast. Progressive CPU lightmapper uses a coarse adaptive grid which can expand, or shrink, based on the scene setup.

    To speed up the baking process while using the Progressive CPU lightmapper, keep the following in mind:
    • Limit the number of baked and mixed lights in the scene.
    • Do not place baked lights at high distances from one another. Even a single baked light placed at the edge of the level far away from other lights will stretch the light grid. This will slow down the baking speed.
  27. jiraphatK


    Sep 29, 2018
    Very informative. I got a lot of new knowledge here. Thank you.
    kristijonas_unity and Wattosan like this.
  28. Wattosan


    Mar 22, 2013
    This is very informative! Thank you!
    kristijonas_unity likes this.
  29. Ka92


    Oct 27, 2014
    Great troubleshooting guide, no doubt a lot of effort was put into it! :)
    kristijonas_unity likes this.
  30. Reahreic


    Mar 23, 2011
    Thank you, this type of feature rich documentation helps greatly.
    kristijonas_unity likes this.
  31. CrossVadarCreation


    Nov 15, 2022
    I took so long to find solutions using "Google" but this doesnt come up at all . tysm, that solved me a lot of questions.
    kristijonas_unity likes this.
  32. Reanimate_L


    Oct 10, 2009
  33. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    Yes, everything written in Chapter 22 applies to Adaptive Probe Volumes as well.
    Reanimate_L likes this.
  34. Reanimate_L


    Oct 10, 2009
    Ahh. . . so low probe sample can be the cause for random black probe?
  35. kristijonas_unity


    Unity Technologies

    Feb 8, 2018
    That's correct. However, black probes could also be a result of invalid data. That's usually caused when probe is located inside geometry.
  36. Reanimate_L


    Oct 10, 2009
    in my case the probe was on empty space outside geometry and some of them randomly getting black probes
  37. Pema-Malling


    Unity Technologies

    Jul 3, 2020
    Overlapping probe positions will also often lead to artifacts like black probes. Make sure you don't have 2 probes on top of each other somewhere.
  38. Reanimate_L


    Oct 10, 2009
    hmm i don't have the project anymore, but it was using APV, which mean probes are automatically placed
  39. Pema-Malling


    Unity Technologies

    Jul 3, 2020
    Ah. If it becomes relevant again, I suggest asking about it in the HDRP subforum instead.
  40. M_MG_S


    Aug 11, 2023
    WOW! So much info!!! This is very informative! Thank you very much!
    kristijonas_unity likes this.
  41. mawettig


    Dec 13, 2021
    "How to fix ligthmap seams:
    This is a common issue that most lightmapping backends face, and it is a hard problem to solve."
    Yeah, ok then.
  42. HIBIKI_entertainment


    Dec 4, 2018
    Instead of creating a PDF the size of a monks lifetime manuscript, because the topics and applications along side project nuances can't be fully determined. Tis why.
  43. JAMSCommercial


    Sep 1, 2023
    is that issue fixed in the new editor? lots of us who have a large map facing this problem
  44. stoofnie


    May 21, 2014
    This is the best forum post ever. BOOKMARKED.
    Radishface likes this.
  45. Din0m1te


    Sep 9, 2015
    This is gold
    Radishface likes this.
  46. jiraphatK


    Sep 29, 2018
    Please make the equivalent of this but for apv
    ElevenArt likes this.