Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

[RELEASED] Magic Lightmap Switcher - Storing, Switching and Blending Lightmaps in Real-Time

Discussion in 'Assets and Asset Store' started by Eugene-B, Apr 7, 2021.

  1. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    photo_2021-04-07_22-52-11.jpg

    Hello everyone!

    Thread moved from Work In Progress forum

    Magic Lightmap Switcher is a Unity editor extension that will allow you to store baked lightmap data and then switch between its instantly or interpolate smoothly.

    The following data is involved in switching and blending:
    • Lightmaps
    • Lightprobes
    • Reflection probes
    • Light sources settings
    • Skybox texture
    • Scene fog settings
    • Any custom data such as post-processing settings, Volume component settings in SRP, or variable values of any of your script‌
    System features:
    • Switching and blending all available baked data in the scene at runtime
    • Using shaders and multithreading for system operation, which allows you to maintain high performance
    • Support for multiple lighting scenarios for one scene
    • Automatic baking and storing process of lightmaps in turn order‌
    Custom shaders:

    The asset will work with any custom shader, unless that shader uses its own GI functionality. If your shader calls on Unity's built-in functions to render lightmaps, reflection probes, lighting from light probes, and etc., then you don't need to worry. Everything will work by default.

    For those using custom lighting features. Write to the developer on any support channel. It's pretty easy to add blending and switching support to your shaders.

    Integration:
    Tested with assets:





    Things to do:
    • Preset manager (added in v1.2)
    • HDRP and URP support (implemented in a separate version)
    • Eliminate possible light leaks while blending lightmaps
    • Supports Panoramic and 6-sided skybox shaders
    • Support for Bakery Lightmapped Prefabs
    • Support for Bakery RNM and SH maps
    • Blending and switching support for Bakery Volumes (if at all possible and efficient)
    • Own lightmapped prefabs (for non-Bakery users)
    • API for easy modification of custom shaders
    I would be grateful for any comments. Good luck to everyone with your projects!

    Asset Store
    Discord Server

    Magic Lightmap Switcher Manual
     
    Last edited: May 31, 2021
    AntonioModer likes this.
  2. AntonioModer

    AntonioModer

    Joined:
    Jul 29, 2014
    Posts:
    36
    HDRP version will be in this updated asset or in separate asset ?
     
  3. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    SRP (URP + HDRP) will be in a separate asset. As it requires a lot of work and support
     
    ftejada, Mark_01 and AntonioModer like this.
  4. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    639
    Looks interesting but... am I being blind? Is there an asset store link? (it's released?)
     
    Eugene-B likes this.
  5. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
  6. AntonioModer

    AntonioModer

    Joined:
    Jul 29, 2014
    Posts:
    36
    @Eugene-B , please make standalone demo with test scene for this asset :)
    This will be useful for determining performance
     
  7. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Yes, definitely. Once done with SRP support. Such a demonstration was, by the way. But for earlier versions of the plugin. :)
     
  8. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Version 1.2 has been sent to the store. Will be available within 2 days.

    Bug Fixes:
    • An error related to paths conflict due to which the interface does not work correctly.
    • Shader restoring is not possible on systems with limited user permissions.
    • An issue has been encountered where the notification that all lightmaps have been successfully stored will pop up indefinitely if you cancel the bake and store process.
    • An issue was found that is causing errors while building the project.
    • Reflections work with errors in deferred rendering. Implemented support for system operation without support for deferred reflections.
    Improvements:
    • Added preset manager. Now you can manage all scene presets from one place and edit them quickly.
    • Added a new manager option. Clear Default Data Folder - Allows you to choose whether to delete duplicate lightmap data in the default folder.
    • Added tooltips to manager options. To see this, hold the mouse cursor over the option name.
     
    Last edited: Apr 20, 2021
    AntonioModer likes this.
  9. SlothicG

    SlothicG

    Joined:
    Jul 2, 2012
    Posts:
    47
    Waiting for URP, super excited for it! :)
     
    Eugene-B likes this.
  10. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    URP support has ended. Tested on 3 verified versions 7.5.3, 10.3.2, 11.0.0 for engines of versions 2019.4.21f1, 2020.3.1f1 and 2021.1.4f1. This may also work for intermediate versions, however, this needs to be verified.
     
    AntonioModer and ftejada like this.
  11. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Version 1.3 (buil-in) has been sent to the store.

    Bug Fixes:

    • An issue was found that is causing errors while building the project.
    • Fixed a bug that prevented adding multiple fields to the Custom Blendable.
    Improvements:
    • The Custom Blendable module has been completely rewritten.
    • Color fields are now recognized by Custom Blendable.
     
  12. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    A message to all potential buyers.

    Do not use the plugin review submission form as a bug report submission form. Instead, use any of the specified communication channels. In most cases, the developer responds within a few minutes.
     
    Last edited: May 3, 2021
    AntonioModer likes this.
  13. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Update 1.31 has been sent to the store.

    Bug Fixes:
    • Changed code to work around the situation when the range of a light source of type Area increased infinitely.
    • Fixed a bug that prevented editing scene lighting settings when the preset manager window was active.
    • Fixed a bug that caused spam in the console when adding multiple empty objects to the blending queue.
    Improvements:
    • Added the ability to select a scenario in which the data after re-baking will be overwritten.
    • Added a warning in the console and in the interface that is shown when an error is detected in the blending queue data.
     
  14. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Testing of the SRP support package (URP + HDRP) begins. Hope it doesn't take too long.
     
    Inspeinre likes this.
  15. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Update 1.32 has been sent to the store.

    Bug Fixes:
    • An error that caused blending to stop if the object has "scaleInLightmap = 0" or "lightmapIndex = -1".
    • Texture format error for Android platform.
    • Light references are lost after reloading the editor.
    • A bug due to which, when creating a new preset, data in all existing presets is overwritten.
    • A bug that caused the rotation values of the light to reset to zero during the first edit.
    Improvements:
    • Ability to move the plugin to any project folder.
    • Ability to specify the path to store data in the "Resources" folder.
     
  16. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    So, after much thought, I came to a solution. Since I was able to get HDRP to work in Deferred mode, albeit without support for blended reflection probes for now, I will release URP + HDRP support as one package, however I will mark it as version 0.9 and as a beta version until Deferred support will not be fully implemented. In addition, the Built-In version will be considered the LITE version, and the URP + HDRP package will also include Built-In and will be considered the PRO version. Thus, users who have already purchased the Buil-In package will be able to upgrade to the PRO version with a discount. For the rest, the package will be shipped at full price (I think $50 would be fair for the current version), it should be noted that the price will be increased when all planned features are implemented.

    Now I am engaged in combining the changes of the latest version of Built-Int (1.32) with the second package. When this is done, I will run some tests on a complex project (eg ArchViz), show the result and then send the package to the store. Good luck for me!
     
  17. Jade_Curtiss

    Jade_Curtiss

    Joined:
    Jul 20, 2013
    Posts:
    12
    Any news about URP?:)
     
  18. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    If all goes well, I will ship this to the store today. :)
     
    buFFalo94 and Inspeinre like this.
  19. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    So two news.

    The 1.33 update for the Built-In version has just become available in the store.

    Bug Fixes:
    • Fixed a bug due to which reflections were incorrect for all bakes in the queue, except for the first.
    Improvements:
    • Changed blending mechanics to support batching.
    • Added the ability to save the state of objects in presets. (enablend/disabled)
    • Optimized lightmap blending code to eliminate unnecessary computations.

    AND

    The Built-In + SRP version has been sent to the store and will be available in a few days.
     
    Jade_Curtiss likes this.
  20. Jade_Curtiss

    Jade_Curtiss

    Joined:
    Jul 20, 2013
    Posts:
    12
    Awesome! Cannot wait to try URP version and integrate to my project with Bakery;)
     
    Eugene-B likes this.
  21. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    83
    Are you able to do model swaps as well. we have scenarios where we have day/night but in the scene the cars are swapped with destroyed versions at night. We can of course call on the models to swap but can we bake 2 different scene states?
     
  22. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    You can add two model variations to the scene and then create two presets using the preset manager. In one preset, normal models will be active, and in another, destroyed ones, the functionality allows this. You need to add these models to the "Game Objects" group in the preset manager and set the state (on/off). Then you can start automatic baking.
     
  23. Jade_Curtiss

    Jade_Curtiss

    Joined:
    Jul 20, 2013
    Posts:
    12
    Where is the "Game Objects" group then? In the preset manager window, only "Light Sources", "Bakery Light Meshes" and "Custom Blendables" are found.
     
  24. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Are you using version 1.33?
     
  25. Jade_Curtiss

    Jade_Curtiss

    Joined:
    Jul 20, 2013
    Posts:
    12
    I'm using version 1.32:p
    It seems to be the feature supported by v1.33.
    Since I don't have tried it, I want to know if the Transform of objects can be saved to preset besides enabled/disabled? cause it's definitely what I need. Thanks in advance.
     
  26. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Hmm, this is available for lights, but not for GO, they only have an on / off state. Describe what exactly do you want to achieve?
     
  27. Jade_Curtiss

    Jade_Curtiss

    Joined:
    Jul 20, 2013
    Posts:
    12
    I have a scene with some objects moving around and they change the GI effect, yeah it's kind of like realtime GI, but the movement of those objects is regular and predictable. Let's say it's not the Light but the objects which change the lighting environment. I wonder if it is possible to use MLS to approximate these effects with several lightmaps' interpolation.
     
  28. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Ok I get it, I'll try to add this functionality today and send you a short patch.
     
  29. Jade_Curtiss

    Jade_Curtiss

    Joined:
    Jul 20, 2013
    Posts:
    12
    Thanks a lot!;) I think it would be more convenient to support this feature in the next version, since I'm still waiting for Unity Asset Store to release your SRP version.
     
  30. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    I'm looking forward to that too.:)
     
  31. Thall33

    Thall33

    Joined:
    Sep 18, 2013
    Posts:
    83
    Our studio has been looking for this exact solution to create high quality VR environments at low cost lighting, outstanding! Keep it up please!
     
    Eugene-B likes this.
  32. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    62
    Looks very nice, but I still could not figure out, how it suppose to be used practically.
    Could you post some examples, that this asset make sense to be used.
    Thanks.
     
  33. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    220
    Yes, I am going to record some tutorial videos shortly. In general, this is intended to be able to bake multiple lightmaps for a single scene and then switch between its or interpolate without sacrificing performance.
     
  34. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    62
    Great. Thanks for the answer. Wishlisted for now.
     
    Eugene-B likes this.
unityunity