Search Issue Tracker

By Design



Found in





Issue ID




Lightmaps are baked incorrectly for GameObjects when their Position is <=-2048 or >=2048 on any of the coordinates



Reproduction steps:
1. Open the attached “IN-59961 Lightmap Bug - 3D“ project
2. Open the “SampleScene”
3. Select the “Cube” GameObject in the Hierarchy
4. Press the F key, while hovering over the Scene view with the mouse, to focus on the selected GameObject
5. Select the “Shadowmask” Draw Mode in the Scene view control bar
6. Observe the red-coloured GameObjects in the Scene view from various angles

Expected result: The GameObjects to both sides of the “Cube” look identical (in terms of which faces are red and which are dark grey)
Actual result: The GameObjects to both sides of the “Cube” look different (in terms of which faces are red and which are dark grey)

Reproducible with: 2021.3.33f1, 2022.3.15f1, 2023.2.4f1, 2023.3.0a18

Reproduced on: Windows 11 Pro (23H2)
Not reproduced on: No other environment tested

- GameObjects, that are contributing to Global Illumination, should appear red in places where the “Directional Light” is hitting them directly and dark grey where the shadows land but that is not the case for GameObjects with a Position of >=2048 or <= -2048 on any of the coordinates
- The “Cube” GameObject in the attached project is used as a line displaying where the 2048 value on the x coordinate is
- Reproducible with the “3D”, “3D (URP)” and “3D (HDRP)” Project Templates (no other Project Templates tested due to time constraints and consistent results between the tested ones)
- Reproducible in a new project
- Reproducible in the Player
- The issue is the most visible with the “Shadowmask” Draw Mode (not supported by HDRP) in the Scene view but can also be observed with the “Baked Lightmap”, “Directionality”, “Shaded” and “Shaded Wireframe” Draw Modes

  1. Resolution Note:

    Thank you for submitting this issue to us. There is quite an easy fix for it. If you assign a custom Lightmap Parameters asset to you Lighting Settings, you will be able to adjust the "Pushoff" parameter. Increasing that until you get the desired results (but no more!) will fix the issue you're seeing.

    This issue is caused by floating point errors in the rays and unfortunately tthere is no one-size-fits-all value.

Comments (1)

  1. djarcas

    Jan 15, 2024 11:14

    The fix simply doesn't work, and causes other errors elsewhere.

    Whilst I haven't got access to the code, it seems like a simpler fix would be using doubles instead of floats, or dynamically increasing the Pushoff parameter on a per-facet basis, based on that's facets absolute distance from the centre of the universe?

    At the very least, the Pushoff parameter could be automatically calculated based on the further light-mapped facet for your Lightmap Parameters asset.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.