Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

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. smmtest

    smmtest

    Joined:
    Jan 26, 2018
    Posts:
    4
    Will URP version be released in April?
     
  2. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    I will try very hard, but I will not promise, as SRP has so many versions and continues to change. And although I already have support for it, there is still a lot of work to do. Also, I think I should be polling the audience available to me about which version is currently being used. I have support since version 7, but it seems to be out of date. In general, I will try to finish with it in April, but most likely it will take May too.
     
    ftejada, AntonioModer and syphon1977 like this.
  3. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    54
    hello, you would have support for bakery? if so, the full lighting mode work with baked shadows?
     
  4. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Hi! Yes, the Bakery is supported and what you say will work without problems.
     
  5. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Magic Lightmap Switcher has just become available in the Asset Store!

    While the asset was being checked, a lot of work was done to find hidden bugs and optimize some things. Thanks to the beta testers for participating, I really appreciate it!

    So the new version is ready and sent to the store, it will be available soon, however I can send the updated package directly, just let me know in PM.

    Good luck to everyone and good luck to the asset!

    Version 1.1

    Bug Fixes:

    • Fixed a bug due to which the Shadowmask was not taken into account by the system.
    • Fixed a bug due to which the Bakery could not bake light probes
    • Unexpected system behavior for objects with a 0 lightmap scale
    • Fixed an issue where lightmaps were not displayed after baking manually using the standard Unity Lighting window.
    • Fixed a bug in the DayNightController (Day/Night Cycle example) script that caused the MLS Light component to be infinitely added to the sun object.
    Changes:
    • Changed the mechanism of the shader patch. Now the patch is launched from the command line with administrator rights (for Windows). This should fix the access violation issue for most restricted users. For the rest, instructions are written in the documentation on how to get around the limitation.
    Improvements:
    • Added a new blend option for CustomBlendable, now interpolation can occur between stored variable values.
     
    AntonioModer likes this.
  6. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
  7. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    I NEED THIS NOOOOOOW !!!!!!!!!
     
    Eugene-B likes this.
  8. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    Ok so, I love this and I love you and I really needed it so THANK YOU!
    That being said, I'm using my own custom shaders and the manual doesn't specify how to implement this on custom surface or vertex/pixel shaders.
    I already sample the lightmaps myself in my custom shaders, so implementing this shouldn't be hard. I see you include a custom Standard shader in there, so I would need to incorporate those changes in my custom shaders. Some advice would be really appreciated to speed things up. :)
     
  9. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Yes, the documentation will change for a while. Definitely. :D As for the shaders. Do you use your own lighting functions, or is your shader just a surface shader that uses the Unity standard library to render lightmaps, reflections, light probes and more?
     
  10. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    It's actually a custom lighting function for surface shaders that does all of this manually: lightmaps, light probes and probe volumes calculations explicitly inside (not automatically generated by unity).
    Then I use this lighting function on all the custom surface shaders I do.
    So I would need to implement your custom lightmap sampling and light probe functions in my custom lighting function and it should work with all my custom shaders.

    I use
    unity_SHA , unity_SHB , unity_SHC 
    to calculate the actual lightprobe myself and
    SHEvalLinearL0L1_SampleProbeVolume
    for Probe Volumes
    Then
    unity_Lightmap.Sample
    and
    DecodeDirectionalLightmap
    for lightmaps, so yeah, all manual stuff.

    If you could put all your magic code in an include and use it as a #define or an inline function, that would be the best :)
     
  11. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    I just bought it BTW. :)
     
    Eugene-B likes this.
  12. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    I have a separate include file that contains the blending functions and all the variables, then built-in Unity functions, just call those functions from this cginc. It seems that we need to work more closely, then I can write a detailed manual for everyone who uses custom shaders and maybe expand the functionality if necessary.

    Can you send me your shader by mail or private messages? I will see in detail how you can modify it and how difficult it is.

    Thank you, I hope this time I don't get 1 star from you! :D
     
    atomicjoe likes this.
  13. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    Then it's all right! I was afraid you just modified the Standard Unity shader and put the code in there. I hate diving inside the Standard Unity shader. It's all over the place, divided in 1000 functions and 10 files :D
    I'm afraid sampling lightmaps inside a regular surface shader is really NOT user friendly: it wasn't designed to allow you to do that in the first place. What I ended doing was making a minimal surface shader, asking Unity to show me the generated code for this and copy-pasting the lightmaping functions back into my own surface shader. It's cumbersome and pretty hacky, but has served me well.
    It's ok. I'll manage it myself, but I'll ask for help if I need it, thanks :)
    HEY! I did bump that review up to 4 stars because you gave great support and were nice overall! (even though I ended up making my own lightprobe placer in the end. But that's just because I'm like that :p )
     
    Eugene-B likes this.
  14. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Ok, then can you tell me later how it went and should I add or change something?
    BTW, MLS function calls in version 1.1 were changed for optimization, so don't swear too much if you see UNITY_BRANCH somewhere :)

    It was one of my first direct works with a customer, thanks so far!
     
  15. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    I always make such a great impression! :D
     
    Eugene-B likes this.
  16. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,274
    I'll do it, I promise. But I don't know when, since I have quite a lot of work to do. I just purchased your plugin now because I wanted to let you know your work is appreciated ;)
     
    Deznom and Eugene-B like this.
  17. TimGM

    TimGM

    Joined:
    Mar 28, 2017
    Posts:
    3
    @Eugene-B i would buy this asset in a second if it supported URP. Just wanted to add my voice to the request queue! Looks amazing. Any rough ETA. It’s in my basket for when URP comes out.
     
    Eugene-B likes this.
  18. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Hey! I hope to be done with this within a month if all goes well. :)
     
    ftejada, TimGM and AntonioModer like this.
  19. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    653
    Same time for HDRP?
     
  20. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Yes, a separate SRP (URP + HDRP) package will be released.
     
    keeponshading and ftejada like this.
  21. Steinberg

    Steinberg

    Joined:
    Aug 18, 2020
    Posts:
    3
    Hi Eugene, any news on HDRP support?
     
  22. Eugene-B

    Eugene-B

    Joined:
    Sep 7, 2014
    Posts:
    264
    Hey, the package has been sent to the store, awaiting publication. As soon as it becomes available, I will report it on all channels.
     
    keeponshading likes this.
unityunity