How to build Lightmaps in Unity 2020.1 | Tutorial

Поделиться
HTML-код
  • Опубликовано: 26 июн 2024
  • In this video, we are going to take a look at Lightmapping in Unity 2020.1 to help you create fast and beautiful lighting in your scene.
    Learn more about Lightmapping in 2020.1 from our Docs!
    on.unity.com/2U7VQIX
    Interested in the newest Graphics Features we added in 2020.1? Click here!
    on.unity.com/2GHYGkR
    Download the Spaceship Demo we used in this video here!
    on.unity.com/2IngTEz
    Chapters:
    00:00 Intro
    00:18 Global Illumination
    01:00 Baked Lights and Static Geometry
    03:26 Baking the Scene
    04:55 Ambient Occlusion
    05:49 Lightmap UVs
    07:26 Final Bake
    Unity Version used 2020.1
  • ИгрыИгры

Комментарии • 112

  • @paulhoover5511
    @paulhoover5511 2 года назад +8

    Thank you for this! This video is SO much better than several similar tutorials on baked lighting. The information is comprehensive and relevant to what one needs to know to successfully set up a scene. It's presented clearly and concisely without long, drawn out and superfluous chatter.

  • @tzmedia5345
    @tzmedia5345 2 года назад +14

    This was very helpful. I wasn't getting the output I was expecting on a recent bake and this tutorial showed me what I'd missed. Thank you!

  • @MsRedNebulaPlays
    @MsRedNebulaPlays 2 года назад

    Incredibly useful, thank you! I'm working on an asset pack for the Unity store and wanted to make sure I had my UVs set up properly to work with baked lighting, and this covered everything I need to know very nicely.

  • @Frologics
    @Frologics 2 года назад +14

    WARNING: Baking a huge scene may cause PC to explode

  • @Oxmond
    @Oxmond 3 года назад +3

    The Progressive Light Mapper is awesome! 😻😻😻

  • @AlexStrook
    @AlexStrook 3 года назад +5

    that was such a clear explanation, great job !

  • @__dane__
    @__dane__ 3 года назад +2

    Thanks for the clarity on this

  • @biocronic2986
    @biocronic2986 2 месяца назад

    First real good tutorial I saw these days. Thank you very much.

  • @walaoRIKi
    @walaoRIKi 3 года назад +1

    good to see this tutorial, definitely helpful for mobile developer. Also note that the metallic and specular effect will not work on baked object

  • @hernandonj
    @hernandonj 2 года назад

    Very helpful and clear. Thank you

  • @ultimatebluegrassplaylistc3087
    @ultimatebluegrassplaylistc3087 2 года назад

    Great tutorial, thanks!

  • @DavidVille
    @DavidVille 3 года назад +27

    At 1:18 "... which dynamic lights cannot do without leveraging other technologies such as Unity's Real-Time GI System"
    Want to elaborate about that? because enlighten was deprecated right? so what is that Real-Time GI System?

    • @HitsuSan
      @HitsuSan 3 года назад +5

      That's the same question that got into my mind...

    • @deontayfarris6777
      @deontayfarris6777 3 года назад +2

      wow your right, it's to be phased out by 2021.

    • @CollapseDev
      @CollapseDev 3 года назад +4

      Unity HDRP has Ray Traced GI for Dx12 Systems. Sadly Dx12 is Windows 10 only if I'm not mistaken.

  • @DanielDaAbadSukarno
    @DanielDaAbadSukarno 3 года назад +1

    Light of unity 😍

  • @lalle5000
    @lalle5000 3 года назад +1

    Amazing video!

  • @nichegames9590
    @nichegames9590 3 года назад +48

    Light in unity feels difficult to me. I should probably watch more tutorials.

    • @hexerei02021
      @hexerei02021 3 года назад +1

      @Tyrone Lotta bot

    • @muzboz
      @muzboz 2 года назад +1

      I try to avoid baking at all costs.
      It just seems to hard to get good results, and takes ages.

    • @Shadowsphere1
      @Shadowsphere1 2 года назад +2

      @@muzboz I wouldn't say to avoid baking at all costs... just to avoid baking if you don't need to. Eventually, there will come a time where you'll most likely need to resort to baking to save some processing when your scenes become too complex. Like if you only have a few point lights or small stuff like that, there's no reason to.
      It takes ages, sure, but it's not like that's unique to Unity. Baking anything takes awhile depending on hardware.

    • @spectregames3248
      @spectregames3248 2 года назад

      hey i remeber you from my video yeah i hate unity lighting because baked lights are useless when thereis a moving object in the enviroment and mixed and realtime always glitch

    • @LucretziaOfficial
      @LucretziaOfficial 2 года назад

      @@spectregames3248 that's why you use lightprobes.

  • @guillaumedeschamps4566
    @guillaumedeschamps4566 Год назад +1

    Thank you very much for this incredible complete and clear video about such an important subject !
    I am working on a projet where the scene is procedurally created (blocks of a corridor are created as you go along) . So i wonder if there is a specific workflow, when you can't see the final scene in the 3D view ?
    Thanks again !

  • @michaelshollaj6428
    @michaelshollaj6428 3 года назад +35

    Thanks for everything, Unity best engine ever !!!

    • @astickman2486
      @astickman2486 3 года назад +3

      You're not wrong

    • @Mr.Epsilion
      @Mr.Epsilion 3 года назад

      Yeah dude of Corse, cheers :)

    • @michaelshollaj6428
      @michaelshollaj6428 3 года назад +1

      @@astickman2486 Of course, Unity can change many people's lives, and I can't imagine how much it will advanced in the future :D

    • @michaelshollaj6428
      @michaelshollaj6428 3 года назад

      @@Mr.Epsilion cheers bro :)

    • @DommageCollateral
      @DommageCollateral 3 года назад +1

      thats why i wanna quit unity

  • @joepeaden1661
    @joepeaden1661 2 года назад

    Solid tutorial.

  • @ayychuchi
    @ayychuchi 6 месяцев назад

    life saving video

  • @sciencetablet2634
    @sciencetablet2634 3 года назад +2

    I was having problems with squaree artifacts, did the generate lightmap UVs option and everything appears smooth now.

  • @DavidVille
    @DavidVille 3 года назад +8

    What are those icons with 4 Unity logos at 2:35 ? some sort of multiscene ?

  • @ninenin1706
    @ninenin1706 Год назад

    very helpful

  • @tworulegames2697
    @tworulegames2697 Год назад

    After baked lightning, are we should change the cast shadows off for these meshes?

  • @Shamysoza92
    @Shamysoza92 3 года назад +1

    Is the wireframe glitch gone when selecting objects in Baked Lightmap mode?

  • @astyy
    @astyy 3 года назад +11

    We need prefab lightmaps! This is a feature that needs official support.

    • @gundalfx
      @gundalfx 3 года назад +1

      Can you please elaborate a bit further what you mean with "prefab" in context of lightmaps? Like having pre-baked GI to sections of a group of 3D Models?

    • @Psycho8Everything
      @Psycho8Everything 3 года назад +1

      @@gundalfx Pretty much, lightmaps local to prefabs. Other engines have the capability and although there is a workaround for Unity, there is still no official support. The engine devs have chimed in saying it's a future feature though.

    • @NOTLonely92
      @NOTLonely92 3 года назад +2

      @@Psycho8Everything this is supported by Bakery lightmapper for Unity.

  • @milesjcarter
    @milesjcarter 3 года назад +1

    1:32 Terrains aren't a good target for the progressive lightmapper? So what should be using for terrains? I haven't seen this mentioned anywhere in the lightmapping documentation

    • @00ArrowMax00
      @00ArrowMax00 3 года назад

      Since you would rarely have anything other then a sun light illuminate your terrain, real time illumination with hard dynamic shadows is really all you need.
      There is no to little bounce light to account for, which is the main target of baked illumination.

  • @RexSmithII
    @RexSmithII 5 дней назад

    Is it possible to bake objects separately in large scenes? Maybe by deactivating everything but the ones you want baked , then can you save that map and move on the next building etc…

  • @maxostlund9334
    @maxostlund9334 Год назад

    Is it possible to import a .fbx-file with multiple 3D-objects, where only a few have a second UV-channel for lightmapping and then generate UV-data for only the rest of the objects, that do not have a second UV-channel?

  • @muhammadumair6306
    @muhammadumair6306 3 года назад +19

    Everything is old as before. Nothing new or improved in lightmapping, except for that margin calculation. Bakery GPU lightmapper is still way better than Unity's lightmapper with smaller lightmap size and better quality. Unity should buy bakery lightmapper and make it part of Package manager.

    • @TedThomasTT
      @TedThomasTT 3 года назад +3

      I think Bakery only works on Nvidia gpus, so I don't think Unity would buy it.

    • @muhammadumair6306
      @muhammadumair6306 3 года назад +1

      @@TedThomasTT they can definitely add support for other GPUs because Unity's own GPU Lightmapper sucks too.

    • @fatBoxSoftware
      @fatBoxSoftware 3 года назад +2

      Yep cannot use Bakery on any of my AMD workstations. Developer said he didn't have plans to support AMD GPUs and it wouldn't be worth the development effort.

    • @muhammadumair6306
      @muhammadumair6306 3 года назад +1

      @@fatBoxSoftware oh c'mon dude look at bakery gpu lightmapper details and quality. To get a good detailed lightmap with unity's lightmapper, you'll get around 20MB to 50MB of size but with bakery, much better quality and details under just 10MB. I am talking about mobile game. Atleast unity should try fix their lightmap packing algorithm which waste huge amount of space in a single texture and continues to bake into separate map without even properly filling the previous one. Yeah that's the only negative point of bakery that it only supports Nvidia GPUs and not AMD which is weird because if they add support for AMD then I think bakery can completely replace unity's lightmapper.

    • @NOTLonely92
      @NOTLonely92 3 года назад +2

      ​@@muhammadumair6306 yeah, Bakery is a killer. I use it in my own project, and I'm so happy with it. As a pretty cool bonus - you can bake lightmaps in a Spherical Harmonics directional mode and then use the SH in your shaders, so the fully static lighing will look like an AAA project's lighting, because you have highlighs and normal maps working.

  • @Gredran
    @Gredran 3 года назад +9

    “Oh boy it’s time to bake some lights hehehe FUUU!”
    Jk it isn’t so bad, especially with videos like this :)

  • @HaroldScottIII
    @HaroldScottIII 3 года назад +2

    Can you have multiple lightmaps to go from different lit settings such as lit room to dark or dim

  • @Jimaniki
    @Jimaniki 3 года назад

    Thanks

  • @bojanjeremic1411
    @bojanjeremic1411 3 года назад +5

    Waiting for Dani

  • @fatBoxSoftware
    @fatBoxSoftware 3 года назад +3

    With Enlighten deprecated what is this realtime GI solution that was referenced?

    • @CollapseDev
      @CollapseDev 3 года назад +2

      Ray Traced GI for DX12 HDRP systems.

  • @CoolSmek
    @CoolSmek 3 года назад +2

    I really liked the real-time dynamic global illumination light maps feature from unity 5. Will HDRP ever get a real-time dynamic global illumination solution, or will it stay deprecated?

    • @LuukDomhof
      @LuukDomhof 3 года назад +3

      The developers have confirmed they're looking at alternatives for the new render pipelines. Also note that the reason it is deprecated is because of licensing changes/issues by the company that created said technology.
      It will likely take a while for Unity to roll their own system, but they've mentioned that they're looking to create a system that is suitable in all project types and not just certain genres.
      As an example they mentioned that they would like to implement a way to bake these maps during runtime to enable truly dynamic worlds to also use this feature. However due to all the different ways of computing and baking said maps having their own advantages and disadvantages it'll take time to find the right way to create such a system that is compatible with all different genres.

    • @CoolSmek
      @CoolSmek 3 года назад +1

      @@LuukDomhof Interesting, thanks for the info. I was beginning to wonder if the only solution for modern systems was going to be real-time raytracing for dynamic global illumination.

    • @LuukDomhof
      @LuukDomhof 3 года назад +1

      @@CoolSmek I don't think it will be, as there are quite a few methods other people have used as well.
      Even though it is annoying to wait, creating a solid system that works on all genres of games is probably Unity's best bet.

  • @skaruts
    @skaruts 2 года назад

    Is there any way to change the lightmap resolution on a per face basis? (This is something that was supported by the Source engine, so that's why I'm asking.)

    • @drakefruit
      @drakefruit Год назад

      lightmap scale in the inspector for the mesh, cant do it per face though

  • @makimake417
    @makimake417 3 года назад +1

    Hey guys is there a way to export lightmaps in full resolution as a file ?
    BR

  • @caden3ds
    @caden3ds 7 дней назад

    I have all of my lightmap settings higher than the ones in this video yet mine still look worse

  • @ElNitro7
    @ElNitro7 2 года назад

    This definitely helped narrow a ton of things down, however I am still stuck on Preparing Bake.... with 5+ hours listed. Any idea how this could happen? I am using GPU 3080, Lightmap Resolution at 2 with Padding 2. I kept the scene simple this time since I am setting up for the final map, and I have had issues with lighting in the past so I wanted to test everything out prior to bringing in my prefabs. Still no luck as it seems. I am running Unity 2020.3.25f1 as project version. Thank you!

    • @ElNitro7
      @ElNitro7 2 года назад

      So I let my project sit over night, and Unity is still stuck on Preparing Bake. Not sure why this is. Could anyone help me in figuring out why?

    • @user-ul5wq3kv4p
      @user-ul5wq3kv4p Год назад +1

      @@ElNitro7 not sure if you found a solution. But did you check under Lightmapping setting > Lightmapper ? and check to see if its set to GPU.
      If its set to CPU , unity won't use your 3080.

  • @_CloudyBunny
    @_CloudyBunny 3 года назад +3

    1:32 So what can I do with the terrain? Any advices? Thanks in advance~~

    • @scottcourtney8878
      @scottcourtney8878 3 года назад +9

      It may be counter-productive to bake terrain. Outdoor scenes often have large areas lit only by the Directional Light (that is, the simulation of sunlight or moonlight), and as such, will render quickly without baking. For interior scenes, any surface may be (and often will be) illuminated by more than one light source. Depending on whether you are using forward or reverse rendering mode, the computation of multiple direct and indirect light sources onto a surface is computationally intensive, hence the desire for baked lighting.
      If your project rotates and dims the Directional Light to simulate day/night cycles (or even if it just swaps fixed parameters for one "day" and one "night" lighting mode), this again would negate most of the benefit of baking because if the light source isn't static, it will not be baked into the maps.
      Combining these factors with the sheer size of a terrain chunk, and this explains why the video assumes you probably won't need (or want) to bake terrain light maps. All else aside, the terrain would have to either consume a huge amount of space in the lightmap textures, or it would need to be baked at a really low resolution with huge texel size.
      This doesn't mean you can't bake light maps for objects such as building exteriors or large rocks that will be placed on the terrain, if you have invariant sunlight in your project. If the terrain is not marked static (which, again, it probably should not be), then shadows from these objects on the terrain itself will not be baked, but self-shadows or shadows from adjacent static objects, as well as any baked-mode lighting from the objects (such as a street lamp) could still be baked.
      Returning to your question more directly, your best friend for improving terrain rendering performance is likely to be managing the scope of what is to be rendered in each frame, using:
      * Camera frustum culling (intrinsic to the camera itself, but somewhat controllable by your setting for far clipping plane)
      * Occlusion culling of terrain chunks and objects that are on the terrain (divide large terrains into chunks, and set them occlusion static but lightmap dynamic -- they can be static for occlusion without being static for lighting)
      * For very large terrain areas, investigate world-streaming techniques either by creating your own or by using third-party tools
      * Appropriate LODs of medium- and high-poly objects, especially foliage
      * If appropriate, tools and techniques such as 3D imposters
      Occlusion culling is likely to be an iterative process, as there are tradeoffs between the complexity and memory usage of the culling data versus the rendering cycles saved by culling. If the culling is too coarse, very few things will cull because the camera will often have visibility for most of the eligible objects. If it is too granular, the culling will be highly effective but might take a disproportionate amount of computation to traverse the culling graph in order to save a relatively small rendering effort. The only way you can know for sure what's best in your scene is iterative testing (though experience will guide your intuition toward reasonable starting parameters).
      Also pay attention to post processing effects, draw calls (and by extension, material atlases and other draw call reducing techniques), texture memory consumption, render quality settings, and all the other things that can influence rendering performance aside from dynamic lighting.
      Hopefully this is enough to get you started down the right road. :)

    • @_CloudyBunny
      @_CloudyBunny 3 года назад

      @@scottcourtney8878 Oh my god! Thank you very much for this dedicated advice! It helps me a lot! You're really a good guy! Much appreciated! (❁´◡`❁)

  • @charlesfocant5891
    @charlesfocant5891 2 года назад

    Hello. When I bake lights that are set to "Baked", they appear turned off in the final rendering... Can someone tell me why?

  • @sanghoonlim6505
    @sanghoonlim6505 2 года назад

    Failed to find a suitable OpenCL device for the GPU Lightmapper, falling back to CPU lightmapper. Please install the latest graphics driver.

  • @asilhan9750
    @asilhan9750 2 года назад

    hello guys, i have problem with light baking. When i try bake light my normal maps are gone. I lose all normal map effects

  • @_felix128old2
    @_felix128old2 3 года назад +1

    why dos my game keep crashing though. every time I try to bake my scene, it will crash and say no fix available and to report a bug but I don't know what is happening. I am using 2019.3 btw.

    • @_felix128old2
      @_felix128old2 3 года назад

      nvm i just upgraded and its fine

  • @DirectorSangHoonLim
    @DirectorSangHoonLim 2 года назад

    If pack margin doesn't work, what is problem?

  • @Furhappens
    @Furhappens 3 года назад +4

    aaaaand unity decided to skip over the only part I really needed to understand and the most annoying part of baking imo... (overlaying uv's)

  • @nobody_there_
    @nobody_there_ 7 месяцев назад

    Ambient Occlusion, not working under URP... tried everything... And Baking lights takes ages...

  • @while.coyote
    @while.coyote 3 года назад +1

    do more of these!

  • @tatoforever
    @tatoforever 2 года назад +1

    GPU Lightmapper doesnt work for me and CPU Lightmapper is so slow that I don't use it.

  • @AurelienFelinMusic
    @AurelienFelinMusic 3 года назад

    OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_MEM_OBJECT_ALLOCATION_FAILURE
    THANKS YOU ♥

    • @fatBoxSoftware
      @fatBoxSoftware 3 года назад

      Generally means you've run out of available GPU memory.

  • @Hoxydav
    @Hoxydav 3 года назад +1

    I need the exact same video but for outdoors scene like a city :p any advive anyone ?

  • @Drmelv0131
    @Drmelv0131 2 года назад

    Will lighting and blooms affect performance for games on mobile platforms?

  • @boreal3255
    @boreal3255 3 года назад +1

    please use a lower clipping plane on the scene view it looks hideous.

  • @landonlikesjazz3420
    @landonlikesjazz3420 3 года назад +1

    Will 8gb of ram and a Rysen 5 4500u and 256gb SSD be enough to make 2d games in Unity?

    • @user-iq1rw2nr8w
      @user-iq1rw2nr8w 3 года назад

      yes

    • @landonlikesjazz3420
      @landonlikesjazz3420 3 года назад

      Well I mean just generally how well will it run a medium long game i guess.

    • @bojanjeremic1411
      @bojanjeremic1411 3 года назад +1

      My suggestion:Make a game that isnt a big game,but that it is having good idea,make it simple,upload,get money,buy better pc

    • @levi2408
      @levi2408 3 года назад +1

      Obviously it depends, but 2D games tend to be easier on the hardware. Your specs should be just fine for reasonable development purposes

  • @milankester7920
    @milankester7920 2 года назад

    auto generate loads forever it doesnt end

  • @1lsgaming27
    @1lsgaming27 3 года назад

    I'm still using 5.6 and 2027.3

    • @NOTLonely92
      @NOTLonely92 3 года назад +1

      2027? Hello from the past! :D

  • @lucutes2936
    @lucutes2936 Год назад

    update it

  • @xGredx
    @xGredx 2 года назад

    Tutorial is usefull, but baking is killing specular shiny completely :/

  • @zorgi7678
    @zorgi7678 2 года назад +2

    The tutorial is intended for familiarization, training and understanding of the material. This means that any person who is not even very familiar with the English language should understand what the presenter is saying. Here, a person chatters, hurries somewhere and does not really understand what he is talking about. Disgusting performance stuff.

  • @wellingtonmoreira9902
    @wellingtonmoreira9902 2 года назад

    5 48

  • @gower1973
    @gower1973 3 года назад +4

    Prefer Unreals way of doing it, you can see when you have the right Lightmap resolution for an object because it turns green in the viewport, showing texel density with checkerboard means nothing to me.

  • @jeronimocollares320
    @jeronimocollares320 2 года назад +1

    I found the solution to all of Unity's (and Unity has many) problems regarding lighting:
    Step 1 - uninstall Unity completely;
    Step 2 - Install Unreal Engine 5.
    Solved.

  • @sarahb1360
    @sarahb1360 Год назад

    missing my ti line sir.

  • @waltermossis2694
    @waltermossis2694 3 года назад

    please subtitile thanks!

  • @x.4132
    @x.4132 2 года назад

    Did everything he said and the result looks horrible... everythin is like "fragmented" and some objects with the same settigns than others are completely black. total bs