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
  3. Dismiss Notice

Feature Request Provide API For Setting Lightmap Index, Scale, Offset in Lighting Data Asset

Discussion in 'Graphics Dev Blitz Day 2023 - Q&A' started by Error-md1, May 25, 2023.

  1. Error-md1


    Nov 9, 2022
    Currently, Unity provides no public API for accessing the lighting data asset generated by light baking. One of the things this asset stores is the lightmap index, scale, and offset of each lightmapped renderer. In some cases it is useful to be able to change an object's lightmap index and position after a bake. An example use case is moving an LOD group's lightmap UVs to all share the same position in the lightmap instead of having their own increasingly low-res patch. This dramatically reduces pop-in but requires manually lightmap unwrapping to ensure each level's lightmap uvs overlap perfectly. I have already implemented this (and it shipped in a game), but it is using a very hacky and completely unsupported script that had to reverse-engineer the lighting data asset to allow modifying it ( This will almost certainly break in the future. I would much prefer if we could get an officially supported editor API for modifying a renderer' lightmap index, scale, and offset.
  2. Pema-Malling


    Unity Technologies

    Jul 3, 2020
    Hey Error :)

    The request definitely makes sense, at least in the short term! We've had an API to modify contents of the Lighting Data Asset tracked for quite a while, but it's been a bit neglected. We dug back up the relevant tickets today, and will break them down and reprioritize accordingly.

    In the longer term, we want to revisit how the Lighting Data Asset works as part of this roadmap item:
    It isn't yet clear how much the existing implementation will be affected.

    It sounds to me like what you are doing with LOD group lightmap UV's could be done as pre-bake step rather than a post-bake step, if you had a sufficient API to control atlassing. We have plans to give the user much more control over the atlassing step, potentially allowing full manual control of the lightmap layout. This isn't directly reflected on our public roadmap, but essentially lies somewhere between these 2 items: