Search Unity

Graphics Magic Lightmap Switcher - Storing, Switching and Blending Lightmaps in Real-Time

Discussion in 'Tools In Progress' started by Eugene-B, Sep 8, 2020.

  1. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    upload_2020-9-15_16-42-26.png

    Hello everyone!

    I want to show you a new asset that is still in development, but is already fulfilling some of its capabilities. Its main goal is to save lighting data for a scene (light probes, lightmaps, reflection probes, position and parameters of light sources) and instantly or smoothly switch between them. However, it seems to be capable of more, such as switching or blending lighting data for specific parts of the scene (buildings, rooms, or individual floors of the same building).

    This is still in development, but what is already ready:

    Blending four lightmaps (night, morning, day, evening) in real time at the shader level to simulate the Day-Night cycle. Blending occurs for lightmaps, light probes, and reflection probes. URP support is done.





    Switching Demo


    Blending Demo


    I would be grateful for any comments. Good luck to everyone with your projects!

    Discord Server
    Magic Lightmap Switcher Manual
     
    Last edited: Mar 30, 2021
    Sab_Rango, Seith, overthere and 9 others like this.
  2. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    As far as I understand it there is a gap in precomputed realtime GI solutions since Enlighten is being deprecated.

    It looks like this would be really useful for mimicking it, e.g. by blending between lighting datasets based on rotation of a directional light.

    I'm definitely interested.
     
    Eugene-B likes this.
  3. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Yes, I'm just trying to get this to work in a build. Everything works well in the editor. Updates coming soon. :)
     
    Kennth, keeponshading and OdderOtter like this.
  4. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    Nice!

    I had been eyeing Magic Light Probes for quite some time now vs continuing down the faked GI path. The potential of Switcher was enough to get me to pull the trigger on buying it. The sale didn't hurt either. :D
     
    Eugene-B likes this.
  5. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Thanks! And yes, the sale will end very soon.
     
    keeponshading and OdderOtter like this.
  6. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    I'm continuing to develop the asset and it's time to mix the reflection probes!
    The baked reflection probes are saved for different times of day and blend smoothly in real time at the shader level.

     
    keeponshading and OdderOtter like this.
  7. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    664
    Would it support HDRP?
     
    AntonioModer likes this.
  8. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Yes, I'm just working on SRP support.
     
    ftejada and AntonioModer like this.
  9. Noah-Essa24

    Noah-Essa24

    Joined:
    Apr 17, 2013
    Posts:
    9
    Is that last video really with baked lighting??
     
  10. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Yes, these are 4 lightmaps (Night, Morning, Day & Evening).
    Mixed mode light source. Blending at the shader level. Just finished URP support. Further HDRP.

    P.S.

    Actually, there is a bug, terrain blending was disabled.
     
    Kennth likes this.
  11. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Blending four lightmaps (night, morning, day, evening) in real time at the shader level to simulate the Day-Night cycle. Blending occurs for lightmaps, light probes, and reflection probes. URP support is done.

     
  12. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    So pretty.

    Since this is being performed at the shader level, will it be possible to use incorporate it into existing custom shaders with relatively minor changes?
     
  13. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Yes, but I don't know yet how difficult it will be, I'm trying to make it enough to replace a few lines, but who knows what exactly and how is written in the custom shader. I will try to make clear instructions for this.
     
    OdderOtter likes this.
  14. OdderOtter

    OdderOtter

    Joined:
    Aug 16, 2015
    Posts:
    44
    Much appreciated!

    One potential option that would be useful if possible/feasible would be an Amplify shader node.
     
  15. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Oh, I'll see what I can do. However, such support is definitely needed.
     
    OdderOtter likes this.
  16. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    HDRP support implemented. Thus, we have support for Standard, Universal, and High Definition rendering pipelines. Full set. The next step is code optimization and organization. And then I will try to add support for the Bakery.

     
  17. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Hi everyone! The asset is currently in beta testing, but for now I've compiled a demo scene.

    The scene was built using the Standard Render Pipeline. Four sets of lighting data are blending in real time, this data contains - lightmaps, light probes, reflection probes for static and dynamic objects, fog settings, intensity, position and color of the main light source.

    Download Playable Demo
     
  18. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    AthrunVLokiz likes this.
  19. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    Nice.
    Does it works with Bakery Lightmaps with different Directional Modes and L1 probes?
     
  20. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Hi! No, I haven't implemented work with RNM and SH yet, but it will definitely be. And yes, it works with L1 probes.
     
  21. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    T
    Most wanted.)
    Very nice.
    HDRP and Bakery would be great.
    Ask Mr F when you face a problem.
     
    Eugene-B likes this.
  22. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    We are in constant contact with the developer of the Bakery, there should be no problems there. :)
     
  23. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    In case you search a complex test environment.
    Today i converted ArchViz Pro Vol 3 Interior HDRP Time Demo to Bakery for fun.
    He has an additional Time Demo (downloadable on his website) which completly loads 3 different baked scenes.

    PLM needs 10h+ when it does not crash or is falling back to CPU
    Bakery around 1.5h for more HQ Lightmaps and all 3 sets.

    The scene load for next scene takes around 4s.
    With blending it should be faster .) if memory can handle this amount of textures.




    day.JPG

    eevening.JPG

    blackout.JPG

    In the Light Explorer (Screenshot) you can see the active realtime and baked lights light for each scenario.

    night lights
    lightst.JPG

    day lights
    day_light.JPG

    Blending also these varying realtime lightvalues would make it complete.

    e.g. every baked Area Light form the windows has also an an additional Realtime Area Light.
    For interior use cases like this an blending of them would be great.
     
    Last edited: Nov 15, 2020
  24. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    I just need a good informative screenshot for MLP, as it is nominated for the best development tool at the Unity Awards 2020, maybe this scene would help me. I would also be happy to test the "Switcher". I will try to contact the developer and see if he will allow me to use his scene.
     
  25. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    And the winner is.)

    The scene is hard to find.

    In the Asset Store there is only the HDRP version with daylight.
    The Time of Day demo you can unlock only on the website with the invoice number....

    https://oneirosvr.com/


    TimeOfDay.JPG
     
    Last edited: Nov 15, 2020
    Eugene-B likes this.
  26. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Looks like I have to buy it :D
     
  27. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    I usually have

    4 differrent
    Lightmaps, Probes and Reflection Probes + Directional Lights
    bake sets.

    • Overcast
    • Sun
    • Evening
    • Night
    for the car exterior


    ext.jpg

    For the car interior it becomes more crazy because you have additionally
    around 8 sets of Lightmaps, Probes and Reflection Probes + around 12 interpolating realtime interiour lights for different night design light variations.

    I could make a nice car related demo when it becomes ready for HDRP.


    int.jpg
     
    Eugene-B likes this.
  28. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    You should.
    The scene is very well organized with 3 different bake setups.

    I think it s doable in a few hours.

    The more tricky think is to interpolate the light and the setups from post processing volumes too for absolut smooth transitions.
    This could be done in Timeline but it would be great to simplfy it by putting the lights and post volumes into your UI to to do the blend of the variables.

    .
     
  29. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    I already have a mechanic that allows me to mix things other than lightmaps, light probes, reflections and fog settings. For example, it can be a variable responsible for the position of the light source, in the same way it can be any other variable, including data from the post-processing volume. This way, you can get smooth blending between any parameters of scene lighting and its post-processing, and all this without costing performance.
     
    Last edited: Nov 15, 2020
  30. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    One more thing.
    The needed additional texture memory for blending several precalutaed sets you could solve with the texture streaming who is out of preview soon.

    I did a similar protype in unreal some years before.
    You could upload the different lightmaps sets to 16k to 64k virtual texture tiling sets.

    At the end you would save lots of texture memory by providing serveral baked light setups.
    There could be only one big lightmap for one light setup who is streamed.

    But therefore the unity devs from texture streaming must deliver some extra work for lightmap streaming and interpolation.
    Meantime, in Unreal you can stream lightmaps but in Unity i don t think they plan it out of the box.
    I asked several times for it one year ago but i got no answer.
    Mostly because Unitys Progressive Lightmapper is a big mess since years and it will be the same the next years and
    generating hq lightmaps is simply not possible for working people with deadlines.)
    Bakery changed that.

    Just saying. When you ask now for it you will get probably in 6 to 18 months.)
    I could support such an proof of concept by voting and by trying to convince some Unity Devs.


    texture streaming.JPG
     
    Eugene-B likes this.
  31. Edeff

    Edeff

    Joined:
    Dec 9, 2019
    Posts:
    8
    This looks very cool! Do you know how long until you're ready for a release? I was looking for quick and easy solution to switching between lightmaps when flipping a light switch.
     
    Eugene-B likes this.
  32. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    I expect to have it out before the new year. SRP ruins my life very much. :D
     
    keeponshading likes this.
  33. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Beta testing continues. Spot light is placed on the test scene. Blending occurs in real time for 4 directional lightmaps, reflections and light probes.
    Thanks to all beta testers!

     
  34. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    820
    Nice. For sure.
    I will start with HDRP in
    Unity 2020.2.1 Bakery and PLM
    Unity 2020.1.17 PLM
    Unity 2019.4.17 LTS PLM
     
    Last edited: Jan 12, 2021
    Eugene-B likes this.
  35. Rom1_Unity

    Rom1_Unity

    Joined:
    Sep 9, 2018
    Posts:
    3
    This asset looks incredible. When do you think it will be available? I can't wait to use it and I admit I really need it for my projects ^^
     
    Eugene-B likes this.
  36. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Hey! Thank you for your interest!

    I wanted to release it earlier this year, but I ran into a huge number of problems supporting all the nearest SRP versions. Now I’m almost finished. Soon the asset will go through new stages of beta testing. I expect to release it in the next month (at least BETA RELEASE)
     
  37. Rom1_Unity

    Rom1_Unity

    Joined:
    Sep 9, 2018
    Posts:
    3
    Ok, so I have to be patient so. I'm working with the Built in render pipeline ; Does it work well with that ?
     
  38. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Yes, the built-in pipeline has been fully functional for a long time
     
  39. labbi5689

    labbi5689

    Joined:
    Mar 25, 2019
    Posts:
    1
    how can i get this package ? could anyone help me to find out the package
     
  40. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,266
    Very cool thing!
    I suggest the next demo should provide some toggles or even better sliders to blend between the lightmaps, at least as an option.
     
    Eugene-B likes this.
  41. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    The plugin is under development at the moment. I have already postponed the release dates several times, as SRP ruins my life. This time, I hope to release it in a month.
     
  42. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    There are switches and sliders in the interface. And even a preview of blending in editor mode.
     
  43. hyperhuzaifa

    hyperhuzaifa

    Joined:
    Aug 21, 2015
    Posts:
    8
    Do you have a release date? Could you please release the built in pipeline version? I don't need SRP support - it's an unstable pipeline on mobile.
    Also, could you release a demo where we can control the blending and move the camera and drag some objects around? I want to see how shadows interact with dynamic objects.
     
  44. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Hey! The version for the built-in pipeline is already done. I'm currently in the middle of supporting multi-scene workflow. I hope to finish this on a week. Please connect to the discord server and write me a private message. Let's discuss which example you need. Maybe I can do it pretty quickly.
     
  45. Jack_Martison

    Jack_Martison

    Joined:
    Jun 24, 2018
    Posts:
    5
    This is what Unity lacks out of box, geniusly done, can't wait for URP support
     
    Eugene-B likes this.
  46. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Thanks!
    I know that I have been promising a release for a very long time. I just try to avoid as many bugs as possible at the start. I'm at the finish line, there are very few left.

    Initially, a version with support for the built-in pipeline only will be available, as a separate asset in the store. Then, as soon as possible, an expansion pack to support URP + HDRP, also as a separate asset in the store.
     
    overthere likes this.
  47. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    The first release of Magic Lightmap Switcher has been sent to the Asset Store!
    This version is for the built-in rendering pipeline only, the SRP version is in development and will be available later.

     
  48. smmtest

    smmtest

    Joined:
    Jan 26, 2018
    Posts:
    4
    because of the day-night lightmaps,i study the shader for several days panfully.its very hard.and i cant understand how URP lit shader work.so i hope your tool can release asap veriy mush!im watching this post every day!forgive my english!
     
    Eugene-B likes this.
  49. smmtest

    smmtest

    Joined:
    Jan 26, 2018
    Posts:
    4
    i cant find it in asset?
     
  50. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    259
    Hey!
    The asset is still in the publish queue. This is a lengthy process. The version that will be released only supports built-in rendering, support for URP and HDRP will be a little later. This is a huge problem indeed. SRP shaders look like ground beef. :confused:
     
unityunity