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 Игры
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.
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!
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.
WARNING: Baking a huge scene may cause PC to explode
The Progressive Light Mapper is awesome! 😻😻😻
that was such a clear explanation, great job !
Thanks for the clarity on this
First real good tutorial I saw these days. Thank you very much.
good to see this tutorial, definitely helpful for mobile developer. Also note that the metallic and specular effect will not work on baked object
Very helpful and clear. Thank you
Great tutorial, thanks!
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?
That's the same question that got into my mind...
wow your right, it's to be phased out by 2021.
Unity HDRP has Ray Traced GI for Dx12 Systems. Sadly Dx12 is Windows 10 only if I'm not mistaken.
Light of unity 😍
Amazing video!
Light in unity feels difficult to me. I should probably watch more tutorials.
@Tyrone Lotta bot
I try to avoid baking at all costs.
It just seems to hard to get good results, and takes ages.
@@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.
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
@@spectregames3248 that's why you use lightprobes.
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 !
Thanks for everything, Unity best engine ever !!!
You're not wrong
Yeah dude of Corse, cheers :)
@@astickman2486 Of course, Unity can change many people's lives, and I can't imagine how much it will advanced in the future :D
@@Mr.Epsilion cheers bro :)
thats why i wanna quit unity
Solid tutorial.
life saving video
I was having problems with squaree artifacts, did the generate lightmap UVs option and everything appears smooth now.
What are those icons with 4 Unity logos at 2:35 ? some sort of multiscene ?
I m curious as well
very helpful
After baked lightning, are we should change the cast shadows off for these meshes?
Is the wireframe glitch gone when selecting objects in Baked Lightmap mode?
We need prefab lightmaps! This is a feature that needs official support.
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?
@@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.
@@Psycho8Everything this is supported by Bakery lightmapper for Unity.
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
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.
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…
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?
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.
I think Bakery only works on Nvidia gpus, so I don't think Unity would buy it.
@@TedThomasTT they can definitely add support for other GPUs because Unity's own GPU Lightmapper sucks too.
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.
@@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.
@@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.
“Oh boy it’s time to bake some lights hehehe FUUU!”
Jk it isn’t so bad, especially with videos like this :)
Can you have multiple lightmaps to go from different lit settings such as lit room to dark or dim
.
Thanks
Waiting for Dani
@Tiger Wave Gaming who doesnt,i am fan from less than 50k
Ew
With Enlighten deprecated what is this realtime GI solution that was referenced?
Ray Traced GI for DX12 HDRP systems.
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?
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.
@@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.
@@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.
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.)
lightmap scale in the inspector for the mesh, cant do it per face though
Hey guys is there a way to export lightmaps in full resolution as a file ?
BR
I have all of my lightmap settings higher than the ones in this video yet mine still look worse
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!
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?
@@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.
1:32 So what can I do with the terrain? Any advices? Thanks in advance~~
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. :)
@@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! (❁´◡`❁)
Hello. When I bake lights that are set to "Baked", they appear turned off in the final rendering... Can someone tell me why?
Failed to find a suitable OpenCL device for the GPU Lightmapper, falling back to CPU lightmapper. Please install the latest graphics driver.
hello guys, i have problem with light baking. When i try bake light my normal maps are gone. I lose all normal map effects
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.
nvm i just upgraded and its fine
If pack margin doesn't work, what is problem?
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)
Ambient Occlusion, not working under URP... tried everything... And Baking lights takes ages...
do more of these!
GPU Lightmapper doesnt work for me and CPU Lightmapper is so slow that I don't use it.
OpenCL Error. Falling back to CPU lightmapper. Error callback from context: CL_MEM_OBJECT_ALLOCATION_FAILURE
THANKS YOU ♥
Generally means you've run out of available GPU memory.
I need the exact same video but for outdoors scene like a city :p any advive anyone ?
Will lighting and blooms affect performance for games on mobile platforms?
please use a lower clipping plane on the scene view it looks hideous.
Will 8gb of ram and a Rysen 5 4500u and 256gb SSD be enough to make 2d games in Unity?
yes
Well I mean just generally how well will it run a medium long game i guess.
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
Obviously it depends, but 2D games tend to be easier on the hardware. Your specs should be just fine for reasonable development purposes
auto generate loads forever it doesnt end
I'm still using 5.6 and 2027.3
2027? Hello from the past! :D
update it
Tutorial is usefull, but baking is killing specular shiny completely :/
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.
5 48
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.
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.
missing my ti line sir.
please subtitile thanks!
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