Search Unity

Unity 5 is receiving a major make-over in terms of graphical fidelity and lighting in particular. Unity has been limited to baked lightmaps since Unity 3.0, but since then a lot of progress has been made in the global illumination field. Now is the time to provide some of that goodness out-of-the box in Unity. One of the new graphics features in Unity 5 is real-time in-game global illumination combined with new and vastly improved lighting workflows and these are the focus of this post. But first some background.

Doll model rendered with path tracing in Unity. Courtesy of Paul Tham, Unity Singapore.

What is this global illumination all about?

Global illumination (GI) is the simulation of physically based light transport. It is a means to simulate how light is transferred between surfaces in your 3D scene and it will greatly increase the realism of your game. Not only that, it is also a means to convey mood and with clever use can be used to improve the gameplay. GI algorithms take into account not only the light which comes directly from a light source (the direct illumination), but also subsequent cases in which this light is reflected by surfaces in the scene using different materials (indirect illumination). Traditionally, indirect illumination has been too expensive to compute within the real-time constraint of a game.

It is all down to this innocent looking equation:

It is really rather simple. The lighting visible from some point in your scene is the sum of light emitted from that surface point (Le) and the incident lighting from the hemisphere above the point reflected into the viewing direction towards the viewer. Li describes incoming light from some direction w’ on the hemisphere towards the point x. The reflectance term p then describes how light is reflected towards the viewer and is dependent on the incident angle w’ and the exitant angle w.

As the observant reader might have spotted L(x,w) is on both sides of the equation and inside an integral to boot. Now if that hadn’t been the case we would have had global illumination in Elite. Since the laws of physics are hard to alter, the research community set about to come up with a solution.

One of the most popular (and oldest) algorithms is path tracing, which basically attacks this algorithm head on, with some tricks added to spend the most time on areas known to be difficult. Path tracing is used a lot in CGI for film and television. Even though a massive amount of research has been poured into this, an image takes in the order of seconds to render (even with a beefy GPU).

Path tracing is typically used in screen-space, so the image needs to be re-rendered from scratch in every frame. This means that it supports fully dynamic scenes: lighting, materials, geometry can be freely animated. This is also a drawback as a new image has to be rendered when the camera is moved, and, since it takes on the order of seconds for the image to fully converge, it will not be appropriate for games.

A not fully converged image has disturbing noise in it and it is also not temporally coherent either so the image will flicker badly as it reaches convergence. Filtering can help limit this effect, but it cannot be completely removed. Below are a few shots taken at various levels of convergence:

Path traced images at various stages of convergence.

Lately a number of hybrid approaches have been developed, many running on the GPU, such as voxel cone tracing. Most of them require a desktop GPU with a fair amount of memory and are appropriate for high-end desktop systems only. In order to provide global illumination that will work well on a wide swath of supported platforms (including mobile) some compromise has to be made.

Enter Enlighten

Enlighten provides an excellent solution to this problem. It very elegantly scales from mobile through consoles up to high-end systems because it constrains the problem it is solving. It has also been battle-tested as it was shipped in AAA titles such as Battlefield 4, MoH Warfighter, and others.

The basic idea is that if some of the visibility is precomputed (i.e. the integral on the right in the rendering equation above) it is possible to modify the lighting in real-time even on mobile platforms.

Enlighten allows dynamically changing:

  • Light sources.
  • Environment lighting.
  • Material properties (diffuse reflectivity and surface emission).

The geometry that is part of the GI simulation has to be static, but dynamic geometry can be relit using light probes that are updated in real-time with the GI generated from the static geometry. In order to do this Enlighten precomputes the data needed for simulating GI at run-time. This data is consumed by a run-time module which is available for many platforms: OSX, Windows, Linux, iOS, Android, PS Vita, PS3, PS4, Windows Phone, Xbox360 and XboxOne. WebGL is in the works, but no definite timeline for this.

Enlighten outputs the following data:

  • Real-time lightmaps.
  • Real-time lightprobes.
  • Real-time cubemaps.

Enlighten is limited to computing GI for diffuse transport. This is the most important mode of transport as it conveys the overall illumination of the scene. Since diffuse transport is generally low-frequency the real-time lightmaps can be quite low-res and updateable in real-time. Support for specular/glossy transport is added by providing dynamically updated cubemaps. In Heckbert notation Enlighten accounts for the following light path subset: L(D)*(S|G)?E. This means that most GI effects are covered. The main missing effect will be specular bounces via diffuse surfaces – commonly known as caustics. To get this effect you will need to cheat.

Below is an example of two lighting setups rendered with Enlighten. These lighting setups were fully dynamic and switching between them is instantaneous.


 Viking Village – dawn

 In this next shot a brighter blue sky was used the sun is higher and more intense:

 Viking Village – sunny day

Environment lighting is grey and desaturated and the sun intensity is lower. Mainly ambient lighting:

Viking Village – overcast day

Lastly a sunset shot with warm reds for a sunset mood:

Viking Village – sunset

Using this technique enables games with very realistic looking time-of-day cycles.

Enlighten precompute

The compromise is that most of the geometry has to be static, effectively all the large scale geometry that will participate in the GI solution. During the precomputation phase Enlighten will automatically break up the scene into systems. It is also possible to affect how these systems are generated. The systems serve to make the precompute a massively parallel pipeline. The pipeline is relatively deep and solves per system tasks. Here is an example of how the Viking Village level was automatically broken up into systems:


Editor visualization of the automatically generated Enlighten systems.

After the precompute has finished the relationship between the systems is known and this can be used in the run-time to partially alleviate the limitation of static geometry. At run-time the amount of indirect light transferred between systems can be controlled. This allows you to fade in bounce between systems and this can be used to achieve effects such as destruction or opening doors.

Enlighten run-time

The Enlighten run-time is efficient enough to run on higher end mobile devices. It runs asynchronously on a CPU thread (or more threads if the platform allows it). The most prominent issue for mobile platforms will be that the direct lighting and shadow maps for dynamic lights needs to be computed on the GPU. So on mobile platforms only a few dynamic lights will be feasible. However, the emissive properties of geometry can be adjusted in real-time almost for free. The emissive lighting computed by Enlighten encodes visibility too. This means that the emissive light is effectively shadow mapped for free, albeit at a low resolution.

Enlighten scales well onto desktop systems and next-gen consoles that could support games using exclusively dynamic lights since more GPU power is available for direct lighting and shadow mapping.

Here is an example of a mobile demo using Enlighten running on an ARM powered tablet:

What about baking

For some titles baking will be the appropriate choice, so this workflow will be supported and developed well into the future. In Unity 5 the lighting inputs: light sources, emissive materials and environment lighting can be tagged as using baked or real-time GI. Baked lighting inputs are baked into lightmaps in the same way as in previous versions of Unity and dynamic lights are handled by the Enlighten run-time. The baked and real-time GI merges seamlessly.

There are also new baking features already in Unity 5. One of those is that now the lightmaps are broken up into components. For each atlas there are five lightmaps containing direct lightingindirect lighting, direct directionality, indirect directionality and AO respectively. After a bake these will be composited into lightmaps used in the game. In the Editor there are controls that specify how these lightmaps are composited. You can tweak these settings to adjust the look of the final output. For example the indirect lighting can be boosted easily. This only requires a compositing job, which takes seconds whereas before a rebake would be needed to do this.

Lighting workflow

Enlighten doesn’t just provide in-game real-time GI. One of the most important improvements that Enlighten provides is a vastly improved lighting workflow for artists. It allows for faster iteration on lighting, which in turn yields better looking content. An iterative mode has been added, which removes the need for explicitly baking the scene. The scene will instead precompute and  bake in the background without any user intervention. The Editor will automatically track changes made to the scene and execute the tasks needed to fix up the lighting. In many cases when iterating on the lighting these tasks will be nearly instantaneous.

The following video shows a live session using the new lighting workflow:

What types of games will work with Enlighten?

As already discussed the limitation of real-time GI is that the large scale scene setup must be known in advance. We had to choose either to pursue a fully dynamic solution that would only work on high-end systems or a solution that covers many use-cases but also works on mobile hardware, thus reaching a wider part of the market. And we chose the latter for 5.0. Below is a list of types of games that may prove difficult with real-time GI:

  • Q: Can I do opening of doors and gates?
    A: As discussed above authoring systems and scripting the exchange of bounce between systems depending on the door or gate will solve this in some cases. (The scripting extensions needed for this are expected to arrive in 5.x.)
  • Q: Can I support destruction?
    A: Support for making objects transparent dynamically exists in Enlighten. This means that objects that may be destroyed in the game must be marked as such in advance. While this is not ideal it should support many use-cases. ( This feature should arrive in 5.x.)
  • Q: Can I download (stream) chunks of level additively?
    A: Yes, systems can be streamed in additively. The systems can be made so that they do not straddle your streaming chunks. This can be done manually or with scripting. (This feature should be available in 5.0.)
  • Q: Can I create a game world semi-procedurally with premade chunks (endless runner type)?
    A: Yes, bounce between consecutive chunks would be possible if the various combinations that premade chunks are arranged in are precomputed separately. This is similar to how you would bake lightmaps (without seams) for an endless runner. (The precompute API needed for this should be available in 5.x.)
  • Q: Can I create game world fully procedurally, Minecraft style?
    A: Short answer, no. However, we are doing multiple projects with Imagination Technologies using their PowerVR Ray Tracing technology for GI previews and hybrid rendering. This could potentially yield a solution to procedural or user generated scenes. The PowerVR Ray Tracing technology supports interactive GI for fully dynamic scenes. It is not yet fully real-time and the first few frames will have visible noise as the solution converges, but it is a very promising direction. It will certainly be able to light user generated scenes assuming some delay is acceptable. (There is no ETA for this as it is still an R&D project.)

What will be in Free what will be in Pro?

The feature split between Unity Free and Unity Pro has not yet been decided. We will announce this in a future blog post.

What is in 5.0

These are the main features shipping in Unity 5.0:

  • Enlighten run-time for in game real-time GI.
  • Iterative workflow (for both real-time GI and baking).
  • Reflection probes.

Beyond 5.0

As we are doing a lot of changes to the lighting workflows and lighting in general some features will slip 5.0 as they need more polish. These are some of the features that will surface during the Unity 5 cycle:

  • PowerVR path traced previews for real-time and baked lightmaps (details here).
  • API for controlling the real-time GI contribution between systems.
  • Enlighten real-time cubemaps.
  • Support for real-time GI transparency.
  • Cloud/cluster precompute/bake.

Some more material is available on this subject: slides for the Unite 2014 talk on GIvideo of the Unite 2014 talk on GI, Unite 2014 keynote (graphics part).

Let us know what you think!

The Graphics Team.

65 replies on “Global Illumination in Unity 5”

[…] Global illumination is an important part of the context that’s needed for PBS. To get a comprehensive overview of how it will work in Unity 5 nothing better than to check our blogpost on Dynamic GI […]

[…] Większość komercyjnych silników graficznych wprowadziła te patenty już jakiś czas temu – CryEngine czy Unreal Engine. Na Unity trzeba było poczekać do wersji 5.0. Obecnie autorzy, którzy są na etapie beta testów najnowszej wersji silnika chwalą się swoimi udoskonaleniami. W związku z tym, jako uzupełnienie, warto poczytać jakie efekty to przyniosło w poprawie jakości i dodaniu nowych możliwości dla twórców Unity: […]

[…] posts Global Illumination Frame debugger Audio Mixer High-performance physics New animation features Physically-based […]

[…] Here’s a link to a recent article talking about it’s implementation in Unity 5: […]

What is the impact of enlighten?Is it going to stuggle with something like a gtx780 like eu4 or is it less demanding in therms of hardware?

[…] wanted to make sure it still works in Unity 5 (it does,) and also explore some of the much-touted global illumination features in Unity 5 and see how SilverLining might integrate with […]

And another question: what exact controls will we have over static lightmap components? I’ve used to color grade them heavily in photoshop, so can we expect exposure / contrast / color correction at least (preferrably in HSV and Lab space)? Or can we just have them exposed to Editor scripting APIs?

Will it be possible to hide certain objects from camera but still make them cast and receive GI (realtime and/or baked)?

[…] en savoir plus sur les méthodes d’illumination globale je vous propose cet article du moteur de jeu video en 3D temps réel #Unity3D que j’utilise pour développer mes […]

Sounds good, makes a bit more sense now! Thanks for chiming in to enlighten me, on a weekend no less.

Ok yes.. pun intended :)


Procedural levels at level load will not be supported in regards to realtime GI in 5.0. We will investigate in the future, but have no concrete plan.

That said, reflection probes + all the physically based standard shader goodness can be used without enlighten. Enlighten add’s only the bounce light part, everything else will continue to work even if you bake your scenes with enlighten.

You can place as many dynamic objects as you like. They can receive GI lighting via lightprobes but they will not contribute to the GI.

For completely procedural worlds, where no base geometry is static, you can still use the universal shader. And all it’s advanced shading. Our plan is also to support reflection probe baking at runtime in either 5.0 or 5.x. (TBD). So you can rely on reflectivity, skybox SH extraction and directional lights to get very nice lighting for completely procedural scenes.

Is there any way to do the pre-compute step at runtime, like during a loading screen? I understand a fully dynamic and changable world like Minecraft can’t be done, but what about a level that is procedurally constructed during a loading screen and then remains static while the player is actually playing?

or are dynamic structures /trees something that could be tackled in the same way lighting the player might be using light probes? You mention they’re relatively cheap, in a large outdoor setting could/should these be generated/placed in a grid format at design time or is that the wrong way to go about things?

@JESPER MORTENSEN This looks great! But wondering how we should be preparing for our game with some procedural elements.

We’re doing static landscapes, but will have player created buildings (with placement location not pre-determined), and dynamic trees (you can cut them down) will we be able to utilize anything from this in combination with current lighting solutions?

If not, I assume we’ll be able to fall back to current lighting solutions completely in Unity 5 if need be? (Currently using Sunshine)

In this case are we able to take advantage of the new built-in PBL/Standard shader stuff, or is that completely tied into Enlighten GI? Thanks :)

මමත් PC house එකෙන් ඹය කට්ට කැවා PC house එකෙ customer care seicrve එක අන්තිමයි ..මම දැන් වැස්සට වත් PC house යන්නෙ නෑ .මම දැන් යන්නෙ Unity එකෙ 1st floor තියන Ink TECH එකට.එකෙ customer care seicrve එක හොදයි. ඉක්මනට replacement එක කරලා දෙනවා .නැත්තම් Unity එකෙ 1st floor තියන Tulip එකත් ෙහාදයි

Hey Jesper, where can I find this “X3 shader following sun” shader? is it already build in into beta5? I could not find anything related. I want to turn up the exposure for the pbr reflections to values bigger than 1.0 without actually changing the brightness of the skybox (it*s a dark space enviroment) but I could not find anything like this.

[…] Se quiser saber mais e inclusive aprender sobre iluminação global, basta acessar o site oficial. […]

[…] Show Links Global Illumination in Unity 5 […]

Will unity 5 support transmissive materials?
Coloured shadows – light passing through stained glass and casting colour onto receiving surfaces?

@MURGILOD: The uniforms used in the shader are the same. The Standard shader does part of the evaluation per pixel and part per vertex though. Coefficients coming from real-time GI are mixed with the baked ones on the CPU.
When it comes to functionality — you gain real-time GI, obviously. :)

@HeliosDoubleSix OMG THOSE ARE AMAZING! Your tests do not look like realtime! Unity 5 is going to be pretty awesome. I can only imagine how this will impact VR.

@Richard think of it this way, ‘real time lighting’. It’s always a good thing. I’m sure you could create scenes that are very similar in look on unity 4.0, but they’d take longer and would be less interactive. Yes the artists have done a good job with the models and lights in these two scenes, but the real benefit is the ability to have this level of detail in real time. You’ll have to discover your own way to take advantage of this tool artistically. Trust me, getting mood and atmosphere will be a LOT easier now.

@JESPER: While I agree a direct side-by-side comparison isn’t going to make sense – it’s not like you just turn up the texture rez or something – it would be interesting to see a trained artist create a ‘best possible’ scene using out-of-the-box features in Unity 4, and then to take the same amount of time to create a similar ‘best possible’ scene using out-of-the-box features in Unity 5. Would help demonstrate that all the lovely demo shots for U5 aren’t just that you hired better artists this time around ;)

Great article :)
Great to see you will be supporting the “removal” of objects from the static GI in 5.x
In regard to this, how performance heavy will the “Enlighten transparent” objects be in comparison with normal static meshes?

Will the light probes generated by enlighten be the same (both functionally and in terms of accessing in shaders) the same as they are in Unity Pro?

[…] know at this point, Unity 5 has been receiving massive visual upgrades. One of these is the new realtime global illumination powered by Enlighten (the very same which powers the GI in Battlefield […]

“Would it be possible to pre-compute at run-time on a custom level mesh? I wouldn’t mind early noise or having the user wait for a procedural scene to bake if it meant I could get good GI.”

That is unfortunately not realistic right now. It may be something for us to look into in the future.
For Unity 5.0 or 5.x, we are however looking at making the reflection probe baking available at runtime. So while you don’t have full GI you still get a big boost in graphics fidelity from having awesome looking reflections for fully procedural levels.

“Unity 4.x style static lightmap baking at one side, the Enlighten hybrid solution in the middle, and a fully dynamic/run-time GI (possibly using Power VR tech) at the other end. Hopeflly, with the ability to blend between these options.”

Enlighten also performs full lightmap baking. Any light can be marked as fully baked or not. Depending on that setting unity will generate full high resolution compressed lightmaps or not.
Any light can be marked fully baked or realtime gi, also the sky light can be marked fully baked or is fully dynamic. All of this is integrated into the iterative bake pipeline. So unity will automatically detect anything that requires baking and do it in the background. This also gives you very nice previews, because as soon as you change a light that is marked as baked, then it will switch back to dynamic GI until all baking has completed, at which point it will automatically switch back to fully baked lighting. All this happens in the background without interrupting your workflow. So it is really nice for trying out things and getting very fast iteration time on your lighting, irregardless of if it is fully baked or realtime GI.

Can’t wait to try Enlighten. As I see it, there should be a spectrum of GI options:
Unity 4.x style static lightmap baking at one side, the Enlighten hybrid solution in the middle, and a fully dynamic/run-time GI (possibly using Power VR tech) at the other end. Hopeflly, with the ability to blend between these options. I just hope Unity pursues the fully dynamic high-end side of things. I personally would like to load user generated levels at run-time and I am disappointed that there currently is not a good GI solution for this.

Would it be possible to pre-compute at run-time on a custom level mesh? I wouldn’t mind early noise or having the user wait for a procedural scene to bake if it meant I could get good GI.

@ARAS Do said shadow improvements include 3×3 tap PCF filtering? Hopefully they do, because the shadows will instantly look 100x better if so ;)

I believe this is really a huge milestone for Unity regarding the look of the output. Quite awesome! And this was also a really interesting read – can’t wait to play with this … a lot! :-)

@Shkarface, I’d rather first we finish said shadow improvements, and blog about them once we have them :)

If we’re doing a game with the static lightmapping option, is there still a step where we need to set light probes and bake those into the scene or is that handled automatically in the bake process? Also, what exactly is the reflection probe doing in the example?

@Shkarface: we do have some shadows improvements in 5.0 (some already in, some more coming – stay tuned). But probably “more major” upgrade of both shadows & image effects will come later in 5.x.

Wow! It’s really awesome – the proper light can change the whole graphics and the ability to add realtime lightmaps and lightprobes is a tool all designers were long waiting for. It’s great that Unity is ahead of industry, as always!

I drop a leave a response whevneer I appreciate a post on a site or if I have something to valuable to contribute to the conversation. Usually it’s a result of the passion communicated in the post I read. And on this article About | Air Plane Games Review. I was excited enough to post a thought I actually do have 2 questions for you if it’s allright. Is it just me or does it look as if like a few of these comments appear as if they are coming from brain dead folks? And, if you are writing at other social sites, I would like to keep up with everything new you have to post. Could you make a list every one of all your community sites like your Facebook page, twitter feed, or linkedin profile?

I have been playing with the new GI while in beta and with some features not finished yet. For those who are curious as to where it is currently:

It is quite fabulous in many regards, I’m just hoping they will fix some of the limits on it preventing really high detail light maps which are hobbling my efforts. There is much left to do, but the promise of what it can offer is outstanding

Global Illumination on high end mobile devices. Great news! Speaking of “graphical fidelity”, what about HDR and Linear Workflow on high end mobile devices?

HI Victoria,I may be spouting an uluoppnar opinion here, but I’m beginning to wonder how much good these promo items do. I recently attended Lori Foster’s event and came home with a bag full of “stuff” that I barely had time to scan. I haven’t looked at it since. How much did all those authors spend of their own money just to have the stuff dumped and the bag reused? Or possibly have all of it stuck in a closet somewhere?I sometimes bring my promo stuff to a friend’s used book store and let her doll it out a bit at a time. I think it makes a bigger impact that way. But I may be the exception. Most authors will promote only their own stuff since the competition is so fierce.I don’t know what the answer is. Maybe I’ll blog about that and see what kind of feedback I get.Ash

I prefer to be able to see the “Graphics Fidelity” of the new features, is to compare the real time renders of Unity 4.x vs Unity 5.x side by side in a video for the same scene. Using the maximum settings of both versions, and so on…

This is awesome, thanks for the info. what about Shadows and Post-Processing Effects as making graphically amazing games would require these effects besides PBR and GI, any updates and/or plans to ImageEffects or Shadows?

Comments are closed.