Search Unity

Official Unite Now - Harnessing Light with URP and the GPU Lightmapper

Discussion in 'Universal Render Pipeline' started by AskCarol, May 27, 2020.

  1. AskCarol

    AskCarol

    Joined:
    Nov 12, 2019
    Posts:
    234
    Feel free to post your questions before, after and during the session.


    Unite Now Session

    Realize your artistic vision while optimizing for performance by learning how to set up light and shadow options in the Universal Render Pipeline. We'll also cover options and optimization tricks for GPU Lightmapper, allowing you to make scenes really come alive with baked GI and Light Probes.



    When
    Thu, June 18, 9:00 AM PT



    Where
    You can watch the session here!
    Make sure to sign up to get access to all Unite Now content.


    ______________________


    A team of product experts from across Unity will be available during and after the session. Our Community team will continue to field questions to foster an ongoing discussion with the community. Please feel free to ask your questions in this thread.


    Some basic rules

    • Only questions related to the topics of the session are permitted.


    • All questions will be fielded by our Community Managers (@LeonhardP and @AskCarol)
      • Replies will have to be approved by the moderators to show up in the thread.


      • Once approved, the questions will be forwarded to the relevant experts.

    We really look forward to hearing from the community.

    Thank you!
     
  2. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    60
    Saw Ciro's Lightmapping using URP yesterday and watched again today. Very cool. How is it you have a Work Flow pull down in the Light settings tab???? Is that unique to the Unity Version? It doesn't seem to be coming with URP.
    Thanks ....
     
  3. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Thanks!

    What do you mean by a "Work Flow pull down"?
    If it's at a particular time, can you tell me the time?
     
  4. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    60
    In the Lighting panel, under the Lightmapping Settings sub, the next is Work Flow in your demo. In my Lighting panel under Lightmapping Settings I have Other Settings sub. I am running version 2019.4.2
     
  5. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Ah, I see now! It's actually the same settings that you have about visualising Light Probes in the scene, just renamed to give the panel a more descriptive name. I believe you would see the new name from 2020.1 on.
     
  6. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    60
    Very good thank you. This was a good demo. I have gone through it 1.5 times since trying to get it all down. URP is very cool and I hope to leverage it in my work.
     
    cirocontinisio likes this.
  7. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    On a tangent - I'm curious about the term "pull down"? Is it common to call them that? I've been in the game many decades and only heard that term a few times (as opposed to "drop down")
     
  8. diggerjohn

    diggerjohn

    Joined:
    Apr 28, 2009
    Posts:
    60
    Very good point.
    I have been in this business for 25 years now and I am embarrassed to say that was a poor choice of words.
    That aspect of the interface is certainly NOT a PullDown IMHO. And frankly I am not sure if DropDown strictly applies.
    I was being lazy and moving fast in my initial description.
    My strict understanding of PullDown is an interface that is a button that includes the icon of a downward pointing arrow that when hit reveals a cascaded of options.
    In this case we have an interactive Arrow with Text next to it.
    This is not a new interface element, it has been around for years and I am sure it has a descriptive name that I just never learned.
    It would be interesting to know.
     
    andybak likes this.
  9. Dotti_H

    Dotti_H

    Joined:
    Apr 23, 2019
    Posts:
    5
    Hi, I really enjoyed the video, it was very useful and I learned a lot. I jumped right into Unity to try out putting together a scene with Mixed Lighting / Baked GI.
    I have a cartoon style house from modular pieces. All the pieces have 2 set of UVs (UV1 for color atlas and UV2 for lightmap).

    I started with a somewhat low-res bake, and I noticed right away the following.
    On the shadow-side, some of the walls are getting darker (in some cases I experienced full black) while the same prefabs on the light side are receiving correct lighting.
    Here is the lightmap of the wall piece:
    lightmap-03.PNG
    Here are my settings:
    Bake settings 02.PNG

    So I have some questions regarding this lightmap bake...
    - Why these lightmap UVs are not occupying the full lightmap? I switched the ground plane off. What is the rest of the map doing?
    - Can mesh intersections (wall planes) interfere with lightmap baking in this case? If yes, how should I solve it?
     

    Attached Files:

    • 3.PNG
      3.PNG
      File size:
      219.2 KB
      Views:
      422
    cirocontinisio likes this.
  10. Kobald-Klaus

    Kobald-Klaus

    Joined:
    Jun 20, 2014
    Posts:
    127
    Good talk!

    1.
    So, did I get this right? Baked light is only working when the directional light is not changing, right? How would I do proper baked lightning, when the sun moves over time or when user sets a different time of the day?

    2.
    My game uses a terrain, that is loaded later. It is inside an addressable scene. I have 2 quality leves for different mobile devices. So the user can pick what ever he wants to download. So, I assume that the lightmap is loaded automatically then, right?

    3.
    The terrain is only one part. The user can select different harbour scenes. These are created by instancing prefabs from json files that are loaded from out server. How would I do lightmaps for these? probably not, right? Or should I maybe change everything to addressables?

    4.
    Speaking addressables: when I set a scene as addressable, will everything related (lightmaps,...) be automatically downloaded? I learned that this does not work for occlusion maps, though!
     
    cirocontinisio likes this.
  11. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Hi Dotti,

    Not sure... did you rebake after you switched the plane off? That should regenerate the lightmap and also the UV layout, thus taking the whole space on the texture.

    I'd say everything can interfere with light baking :D But I would need to have much more info on your scene setup to know.
    One thing I see is that you are using "Baked Indirect". So you shouldn't expect to see much baked light on the side of the walls, since they are very exposed. In this case their colour would be almost entirely the result of direct lighting, so my question is: are they on the shadow side of the building?
    If you're trying to bake all lighting use Shadowmask (not available in URP) or Subtractive as Mixed modes.

    Also, can you please bake and then switch the Scene to show us UV Overlap and Texel Validity. That should help identify problems. More info:
    https://docs.unity3d.com/Manual/ProgressiveLightmapper-UVOverlap.html
    https://docs.unity3d.com/Manual/GIVis.html
     
  12. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Thanks Klaus, I am happy you liked the talk!

    That would not be "baked". As the name implies, baking is an irreversible process: once you bake a cake, you can't "unbake" it, right? :)
    I think what you are asking for is more akin to what is referred to as Realtime Global Illumination. So the idea that you pre-calculate "some stuff" before, and then at runtime do the rest of the calculations. As you can imagine, Realtime GI is super expensive on the CPU due to all this processing and ray-shooting.

    Unity at the moment doesn't have a Realtime GI solution as we are dismissing Enlighten and still working on a new one. However as I said, it might be that you can do without Realtime GI in many cases. One way would be to just have realtime light, without bounces. Less pretty, but more performant! You could bake only Ambient Occlusion? Or bake only the bounces, using Baked Lighting + Baked Indirect Mixed Mode. This is not a perfect solution, but it should give you the ability to at least turn lights on/off, fade them slightly, etc. For a full day/night cycle it might not be the best - but it really depends on the art style you have.

    Yes, but you also need to (obviously) bake 2 different lightmaps, one in each scene.

    Unfortunately we don't have the ability to bake lighting inside Prefabs :( So one solution here would be to bake each Prefab, on its own, in their own scene. And then load the scenes. Obviously this means that while Prefabs can self-shadow themselves and have Ambient Occlusion, they won't cast baked light/shadows on top of each other.

    It should! What do you mean by occlusion maps? The occlusion data that gets generated with the Occlusion Culling process? Did you read this?
     
  13. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    569
    cirocontinisio likes this.
  14. Dotti_H

    Dotti_H

    Joined:
    Apr 23, 2019
    Posts:
    5
    It turned out I missed out some overlapping lightmap UVs for those parts. That was the reason they came out full black on the shadow side. I rewatched the video, and double-checked some problematic points, and could solve most of the problems with the help of the viewport visualization tools you mentioned. So it was just human error :) Anyways it is very nice to have a thread like this, thank you!
     
    cirocontinisio likes this.
  15. cirocontinisio

    cirocontinisio

    Joined:
    Jun 20, 2016
    Posts:
    884
    Looks great, I'll try it as soon as I can and maybe use it in some project.
    And it would be amazing to have it as a possibility inside Unity, we are aware of that.
    I'll poke the Prefab and Lighting teams and see what they think. There might be some technical challenges in making this a universal solution that we are not thinking of here.

    Nice, glad you solved it!
     
    Geejayz likes this.
  16. castana1962

    castana1962

    Joined:
    Apr 10, 2013
    Posts:
    400
    Hi. It is "GREAT" this post about URP Lighting topics. I need to learn it for my own VR project !! and thanks Ciro for your talk about this topic !!!
     
  17. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    3,527
    Any updates on Radeon denoiser coming to mac?
     
  18. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    JoNax97 likes this.
  19. SmartCarrion

    SmartCarrion

    Joined:
    Jul 27, 2013
    Posts:
    27
    Great talk, thanks. I have tons of objects not batching because they use different light probes, even though the objects are very close together. How can I get around that and get my draw calls down?
     
  20. stacispsomadellis

    stacispsomadellis

    Joined:
    Aug 18, 2019
    Posts:
    1
    Amazing tutorial and thank you very much for this. I have three questions though.

    At 18:54 you start explaining how the lightmapping works and my question is this: You say that texel is shooting rays that try to find the directional light or environment light etc. It should not work the opposite way, where the directional light or the environment or any other light source is casting light rays that our bouncing on the geometry and are captured on the lightmap? This is what I have understood from other tutorials as well, and also, this is what I know from other software as well (Mental Ray, Arnold, Keyshot, Marmoset etc)

    Moreover, in your scene you have a lot of light probes. Are they not too many for the scene? I mean that there should be a couple of probes where there is no shadow, and then probes wherever they are light difference (shadow etc). If I noticed correctly you had A LOT of probes where there is no shadow and I would like to know why. Also, if you have so many probes in a scene like this it would not affect dramatically the performance of the game?

    Also, a question not generated from your amazing tutorial, but a problem that I have for a couple of days now and I cannot find a solution. I just installed Unity 2020.1,14f1 and, in the beginning, I could do have a Progressive GPU Light mapper and everything was working smoothly. But the last couple of days Progressive GPU makes Unity crash. I have a Lenovo y50-70 with GTX860M and 8GB Ram. The same happens with and without URP. Is there something I might be missing?

    Looking forward to your answer and thanks again for this great tutorial