Unity 5 Graphics – Lighting Overview – Unity Official Tutorials

Unity 5 Graphics – Lighting Overview – Unity Official Tutorials

Lighting in Unity is more fully featured than ever. The lighting pipeline includes realtime global illumination, in addition to traditional baked light mapping techniques. These combined with physically-based rendering and the standard shader give more power and versatility to light more complex scenes. Unity uses physically-based rendering, or PBR to create a friendly way of achieving a consistent plausible look for materials under all lighting conditions. In order to do so, Unity models how light actually behaves and follows the laws of physics on how light interacts with materials. These materials are usually created using the standard shader. The standard shader makes physically based rendering easy and accessible to use. One of the most powerful tools in the Unity pipeline is Unity’s realtime global illumination, or GI. Using GI, all lights in the scene can effect the object’s within range with both direct and indirect illumination. Direct illumination comes from lights shining directly on the objects in the scene. Indirect illumination however is the light reflected, or bounced off of the light surfaces in the scene. This bounced indirect light can illuminate nearby objects mimicking how light behaves in the real world This indirect light is effected by the colour of the surfaces it bounces off of, taking a contribution of that surface’s colour with it. Direct and indirect light will blend together to create a much more realistic look. In addition to the default main camera a new scene in Unity comes with a default sky box and a default directional light aligned with that sky box. Each scene also contains default values for ambient light. Ambient light illuminates all surfaces in the scene. Ambient light is controlled by the settings in the lighting panels Environment Lighting tab. Ambient light can be created by either using a sky box, a user generated gradient of 3 colours, or a single colour. All objects added to the scene will receive ambient light unless the ambient intensity value is set to 0 or the ambient light’s colour values are set to black. It is rare, if not impossible for any real-world material to have absolutely no reflectivity. By default all objects in the scene will also receive reflection information. Even though the cube, sphere and plane in the scene are unlit and ambient light is none they still receive lighting information in the form of reflections. The default reflection source is the sky box. This can be changed to a custom cube map. To receive no default reflections either set the custom cube map to none, or remove the sky box. It is worth noting that the default sky box is procedurally generated and new procedural sky boxes can be created and saved as assets. When lighting scenes in Unity we can work with realtime lighting, baked lighting, or a mixture of both. Realtime lighting is more easily modified at run time. but it comes at a cost to performance. Baked lighting on the other hand pre-calculates much more detailed lighting information and saves it to a light mapped texture on disc. This light map information is then read from the texture at run time, avoiding the need to do any lighting calculations when the project is running. This saves performance, but at the cost of dynamic changes in the scene. Baked light maps are not updated at run time. Lights can be switched between realtime, baked, and mixed lighting on a per-light basis. Using baked lighting exclusively would be more appropriate for target platforms such as mobile devices with lower performance capabilities. The light mapping system can either work continuously or on demand. When continuous baking is selected lighting changes will be baked in the background while editing. These changes can either be properties adjusted in the inspector, or objects changed in the scene. When continuous baking is not selected changes will only preview on demand. When the Build button in the lighting panel has been selected. In this scene there is a directional light coming in through the skylight in the ceiling. This light contributes to the illumination of the entire scene as the light bounces off of the surfaces it lights directly, on to other nearby surfaces in an indirect manner. This light continues to indirectly illuminate nearby surfaces until the strength of the light fades and it can bounce no more. Decrease the intensity of the light and the illumination of the scene decreases accordingly. Likewise, if the directional light is rotated to directly light a different part of the scene, it will now illuminate the scene in a different way, with both it’s direct and indirect lighting. As materials created with a standard shader can mimic a wide variety of physical surfaces and different materials can have different amounts of reflectivity this can effect the scene’s lighting. To help balance this the Bounce Intensity can be adjusted on either a per-light basis or globally by adjusting the settings in the lighting panel. Adjustments can be made here to artificially change the potential bounce of light from a lit surface. Adjust the mount of indirect light in the scene, and more. In addition to lights we can use emissive surfaces to contribute to the scene’s lighting. This scene is lit with a variety of lights and light types, including emissive surfaces. Emissive surfaces are a light source, but they behave very much like indirect bounced light. The primary emissive surfaces in the scene are in the main corridor junction. But additional panels are located throughout the scene. All of these emissive surfaces use the standard shader’s Emission property by adjusting the Emissive scale. The float value next to the Emission property and by adding a touch of colour, the mood of our scene changes. As these lights can participate in realtime light mapping they can be controlled at runtime using code or animation to create complex changes in mood while our projects are running. The final contributing factor in lighting a Unity scene are probes. There are 2 types of probes in Unity. Light probes and reflection probes. Light probes sample the lighting in the scene at different positions in the world. The information in these probes can be used to light dynamic elements in the scene such as characters or other moving objects at a low cost to performance. Reflection probes on the other hand act as a single point of reference to calculate reflections from Surrounding each reflection probes is a cuboid that specifies what should be included in that reflection. These probes sample the elements surrounding them using box projection, and store that information in a cube map. Materials with reflective surfaces that are on objects within the reflection probe’s volume can then reference this cube map to create reflective surfaces. By default there is one built-in reflection probe in every scene. This default reflection probe reflects the sky box to create basic reflections. For more detail in the reflections additional reflection probes should be added and positioned appropriately for the reflective objects. It is worth noting that phyically-based rendering works best in linear colour space. Linear colour space will give a more realistic and mathematically correct result. For best results make sure that the colour space is set to linear in the project’s Player Settings window. Linear colour space is the default setting. Be aware that not all platforms support linear colour space however, and that gamma is currently the required colour space for most mobile platforms,. When looking at all these aspects to lighting a scene in Unity they can be summed up effectively with the main contributory factors. Ambient light. Reflections. And light sources. Working with materials created with the standard shader being drawn using phyically-based rendering with global illumination to calculate the indirect light and create more complex, more realistic scenes. Subtitles by the Amara.org community

63 thoughts on “Unity 5 Graphics – Lighting Overview – Unity Official Tutorials

  1. Very excited! I hope you guys got a lot of tutorials for Unity 5 because there's a lot of new features packed in

  2. Anti-Aliasing is terrible in every Unity video I've seen. Is there or are there any improvements which can be made to this?

  3. How is the Volumetric Light at 0:30 made? is that with a plug in on the asset store? when they show the same scene at 7:40 it no longer has the Volumetric Light On….

  4. When I start a level in the editor the GI works flawlessly, but whenever there's a Application.LoadLevel() call, if Continuous Baking is enabled, the baked/ precomputed GI data isn't loaded. Everything works perfectly if Continuous Baking is disabled.

    Does anyone have an idea of what i could be doing wrong?

  5. I wish Unity 5 provided demos like Unreal 4 did on there youtube page instructing how to use every part of the engine for new users. 

  6. Does anyone else realize how absolutely insane and powerful is this?
    I remember doing some light rendering with MAX 10 years ago and it took forever to calculate. Amazing job Unity!

  7. instead of commentator voice ,a real programmer commenting  is best and have more impact . this is like robo taking to my ears .

  8. Sigh
    I do not like how slow the Enlighten is when "baking" the geometry ready for realtime global illumination. The simple Cornell Box took up to 8 minutes, just to "bake". And the Sponza scene took well above 15 minutes.
    Granted it can make it look pretty, and it really is reminiscent of how Source engine does its global illumination, only this is realtime.
    But I would like it to be alot quicker, its a simple mesh for f*ck sake, it should not take this long to bake it.
    I really wished they had gone with the Voxel Cone Tracing route.

  9. Where can I find the Light Shafts script that you have enabled in this scene? I can't seem to find it anywhere and it behaves differently than the Sun Shafts script that I can find.

  10. i have some problems..  what could it be?
    Failed executing external process for 'Clustering' job. Exit code: '105'

  11. can anyone tell me how to do this effect 8:00 ???
    I want to have a object that emits light – emission, and I want to control its color realtime. But so far this only works for normal lights
    Pretty sure I tried everything so far

  12. Guys I am trying to take a model made in Sketchup, and effectively model how new lighting can affect the room…I am just barely beginning to use Unity..all I know is how to make things in Sketchup, and move them into Unity…can I have some help, please???

  13. Are thos reflection probes available for free???? Btw I love those light emissons!!! Amazing work unity!!

  14. Please consider making an actual tutorial how to set up a scene for both realtime PC and baked mobile lighting approaches
    at the moment it is way too confusing to work with

  15. I have a question:
    At the editor if you have Continuous Baking enabled it takes a while for it to rerender the scene, like at 5:30. In play mode does it takes so long to rerender?
    Because if it does so, it will look terrible!

  16. @Unity Went i use unity 5 it always crash but never mind i still got unity 4 but went i try more then two lights it will make a crazy stuff like : lights will go to 5 mile away, Lights will not working and Spotlight don't work. "Please help me about that"

  17. I solved my problem with long baking times in unity 5 by selecting the baked object then going to the Lighting->Object tab and then setting it to Default-VeryLowResolution at Advanced Parameters .. bake takes 30 seconds on a pretty complex city-mesh now.. compared to before when it took … forever … its pretty good.. and the quality is not that bad .. I will tweak some more

  18. www.udemy.com/unity-5-lighting-fundamentals/
    Check this free course for a more information on Lighting in Unity 5

  19. when i add a tree, the tree texture (optimized texture) chances to grey and looks like there is some light bakes in. Fog i have disabled. Some ideas?

  20. I want more information about reflection probes… They don't seem to actually do ANYTHING LOL

  21. Does anybody know of ANY way to use AO maps in Unity? I thought light maps in a game engine are like standard feature, I didn't know I should search the whole freakin net for 10 straight hours and not finding a straight answer on anything. Why is it so impossible to have a damn tiling texture and then a separate channel with the AO? Is it REALLY too much to ask???

  22. looking for good map designers that can make an apocalypse type feel but sorta like ark survival if you know what that is msg via youtube or skype gamingboi4

  23. Where can i find in unity 5.4.0f3 the image effect cauze iwant to put some effect in my project but i cant see the image effect in my unity :* Please help!

  24. I got a question. Don't AnimatorsGame designers do this? Is it really necessary for us to do that? Don't make the fighting effects too?

  25. I really like free assets from store. Iam use them only for research purpose and it helped me a lot to discover specular puddles on dirt, it would be nice to add more stuff like this for learning trending game mechanics. 🙂

  26. But what the hell do you do when you're making an almost 0 light scene, with just a flashlight? You can't bake it, and metal/smoothness increased shaders reflect almost nothing if your ambient lighting is black

Leave a Reply

Your email address will not be published. Required fields are marked *