04 - 04. Learn the Unreal Engine- Light Baking

in #art4 years ago

lightBaking.png

Greetings! In this video, we will cover how to bake static lights using Lightmass. If you haven’t already, make sure to watch the previous lessons in this serie so you don’t miss anything.

One important aspect of a good lighting is what we called global illuminition or GI for short. GI is representation of light rays bouncing off surfaces and indirectly illuminating a scene, just like in real life. While Gi is now the norm in popular renderers of the likes of Vray, Cycles or Arnold, it is still too expensive to be calculated 60 frames per second in real-time renderers like Unreal. To solve this issue, Unreal comes with Lightmass, a renderer used to compute static and stationary light contribution to a scene before a game is shipped or an animation is rendered. The result is a texture called lightmap that is applied on all meshes with proper UV. With that out of the way, let’s bake some lights.

Assuming you have your lights setted up using static or stationary mobility, the first thing we need is an actor called LightmassImportance Volume. Search the name in the modes panel and drop it in your scene. This box tells lightmass where to spend calculations so we have to make sure the box is large enough to encapsulate the scene but not unnecessarily large to waste computation efforts. As a rule of thumb, prioritize area where the player or camera will be most of the time. If scaling the box is a problem, try shift+4 to go in edit mode and move individual faces. To learn more about that feature, make sure to watch my lesson on BSP for level design.

With the volume in place, we are ready for a test bake! To bake your lights, hit the Build button on level toolbar and let Lightmass do it’s thing. Now the time needed will vary depending on the number of lights, quality mode and level size.

And there you go, global illumination. If some objects in your scene look broken though, they might not have proper UV to correctly display lightmap. A lesson will be released to deal with these problems.

That’s good and all but we can achieve better results. Reach the arrow on the build button to reveal a menu and go down to Lighting quality. Lightmass has 4 quality levels. Preview for quick and cheap results to production for the best quality. Beware as the baking time will go up exponentially as you move up the list.

Yet, we can still achieve better results. You might notice some shadows lacking resolution. The way to sort this out is to increase the lightmap resolution for surfaces lacking details.

Select the mesh and go down the detail panel to find the lighting category. In here, Check on OverridenLightmapRes. This is a texture resolution here so for the sake of optimization the value to input should be power of two. 64, 128, 256, 512 etc. For a starter, increase the value by 2, bake and repeat until desired result.

Don’t get carried away though, higher values are longer to bake and demands memory but weird artifacts might start to show so keep a reasonable level. For better control over this, switch the viewmode to lightmapdensity. Blue means poor resolution, green is ideal and red is too much. The general idea here is to have a nice green for a good balance between quality and performances.

And yet, it is still possible to improve. Up in the level toolbar,go to Settings and click World settings to reveal a window next to the detail panel. Under the Lightmass category, you will find settings and options defining how lightmass renders. For example, check on Ambient Occlusion and bake again to give an extra depth to your scene. Playing around these settings can lead you beyond production quality. But proceed with caution, baking time will greatly increase.

On top of that we could add a bit of post processing but that’s for another lesson.

This wrap’s it up for this one. With everything you’ve learned so far, experiment and you might get surprising results really fast. In the next lesson, we will add details to our lights, pushing the quality even higher. Until then, take care and have fun.

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.030
BTC 67978.59
ETH 3270.89
USDT 1.00
SBD 2.65