We have received many questions about our lighting workflow for archviz in UE4, so we decided to write this article and detail some of our process.
Lightmass is the system responsible for calculating indirect lighting within Unreal Engine 4. We blazed through the Lightmass settings and will share what we found.
I have been developing this lighting workflow since I have started with Unreal Engine 4 (more than one year ago). I tried to migrate the same lighting concept’s from my vray’s lighting workflow to UE4, with a simple and intuitive way to lit all kind of scenes. In this article you can see some images of our work and the beautiful quality of lighting achieved in UE4.
It all starts with a Skylight
We will begin with a very simple scene adding a Skylight for general lighting. Why we use a Skylight? This is the most correct method to approach the real-world lighting behavior. When we work with still images renders as Vray or Mental Ray, we are able to simulate more light using hidden lights into the room to let the environment balanced.
Let’s take two examples:
The lighting of an apartment where the user can walk through every room, or a house where the user can walk on the outside and inside area: It is not correct to add extra lighting (bounce card). Also is not recommend changing the intensity of the indirect lighting of the scene (via postprocessvolume or in the lights itself), since the standard already suggests a similar quality to the behavior of indirect lighting in the real world (physically correct).
Therefore, using the skylight to lit the scene, we will have a standard intensity of the natural light (sky light) in all open spaces(doors, windows, etc). If any of your indoors is too dark, we simply use the method from real life … Open your windows, doors and turn on the lights.
In this way, we will have the same correct behavior of the lighting on the outside area, however we need a controller for increasing and decreasing the exposure of each environment (external / internal) – in the same way as in our eyes and more sharply in a photographic camera.
Note: Imagine am indoor space in a sunny day, the human eye gives the possibility to see a balanced image of what is around us and what is outside. However when going out to an external environment, our eye adapts to the amount of light decreasing the lighting entry in our iris in order to be able to see in a balanced way these environments.
A photographic camera also has a similar system, however it can not balance the exposure of the external lighting with the internal. To better understand this topic I recommend this article about Dynamic Range.
To reduce this contrast deficiency and light balance of a conventional camera, an architectural photographer uses techniques such as bounce cards and tends to turn on the artificial lighting available if the environment is too dark. However in cases of well-lit environment with natural light, this is not necessary.
So in an environment that is not adequately illuminated the ideal balance is always with the artificial and natural lighting, it will not be practical to use a PostProcessVolume to balance the exposure for each specific environment.
Since when I started thinking about this workflow, I realized it was never tested and there was not correct parameters to improve the calculation of general indirect lighting. There was only a few parameters available in the Editor and the level of scalability of these configurations (Preview, /Medium, High and Production). But this method was not enough to achieve an acceptable quality for an archviz scene, so the only way out would be to study the BaseLightmass.ini.
Note: We do not use the bounce card method. I do not recommend it because besides increase your render time, it will never be possible to render an internal / external environment with the same quality.
Setting the parameters in Editor. We will work with these values at first.
Static Lighting Level Scale = 1.0 Num Indirect Lighting Bounces = 20 Indirect Lighting Quality = 10 Indirect Lighting Smoothness = 1.1
So we will use the default UE4 configurations: In the first image we have our first test, with the default configurations of UE4, rendered with the light preset “Medium“.
To have a higher definition in the shadows of lighting in general, we will work with the “Static Level Scale”.
Here are some examples of how it looks when we start to reduce this value:
Note that if we set the “Static Lighting Level Scale” to 0.15, spots on the lighting coming of Skylight begin to appear . To fix this, we will open the BaseLightmass.ini and change the value of the parameter “NumHemisphereSample“.
We will change it and test again:
As we can see, this parameter is responsible for eliminating some lighting problems.
We can always work with the following relationship: the lower your “Static Lighting Level Scale” is, you will have to increase the value of “NumHemisphereSamples” to get away any bugs, thus causing a considerable increase in render time.
Finally we have the last image rendered with the value of Static Lighting Level Scale = 0.01 and NumHemisphereSamples = 512.
There isn’t so much visual impact, then we can consider the value between 0.15 to 0.3 ideal for these scenes.
On these scenes I used the “Static Level Lighting Scale” of 0.15 with the lightmap of 1024×1024, 512×512, 256×256.
As we can see, there is little significant loss in the definition of the shadows. In a large-scale scene we will have to abdicate of perfect shades definitions for a render time optimization and also to optimize the project timing.
These small glitches in the shadows will be not so perceptible in a scene in motion and therefore I consider valid we use lightmaps in low resolution in some cases.
I recommend using 1024 (or greater) for lightmaps in walls / floors / ceilings that will receive a lot of shadow details from other objects in the scene.
Setting Artificial lights on Unreal Engine 4
In some situations those parameter could not eliminate all artifacts of lighting, especially in areas where we have little lighting or areas where we will have artificial lights.
For this we have to optimize other parameters. We will begin this scene by adding a few spotlights and point lights. All of them are set as “static” and the lightmap size to 1024.
Starting from the last configuration:
(Editor) Static Lighting Level = 0.15 (BaseLightmass.ini) NumHemisphereSamples = 256
As we can see, several light leaks appeared coming from artificial lighting. This is because we have an insufficient photons towards improving this calculation.
We will then modify the following parameters:
IndirectPhotonSearchDistance = 180 ( This parameter will help us to eliminate the light flickers at the corners of the walls. If the maximum radius is set too high, large parts of the kd-tree will be searched to find the nearest n photons in sparse regions, only to result in a very low radiance and your scene will be too dark on the corners. This is a waste of computation time. If the radius is much too low, you will experience a lot of small lighting leaks and you will have to increase a lot of your IndirectPhotonDensity.
Start with a large maximum radius and keep reducing it and rerender until artifacts become visible. You should set a value “lower enough” for this. It’s a trial-and-error process sometimes.
We can get optimized render time lowering this value, however we will have to greatly increase the two previous values (IndirectPhotonDensity and IndirectIrradiancePhotonDensity) to prevent light leaks.
After many tests I suggest using a value between 180 and 240). This was the best range of values that I have found between quality/rendering time.
NumIrradianceCalculationPhotons = 4096 (Leave it at 4096) IndirectPhotonDensity = 3000 IndirectIrradiancePhotonDensity = 1500
The flicker of illumination gradually begin to dissolve, however we need to increase these values until they disappear completely:
There are still flickers, we will increase again:
So we will have a good result, free of flickers in lighting. Check the whole process below:
We must begin to test the lighting only with the walls and the main static objects in the scene. The reason for this is the slow calculation of Lightmass. I suggest start testing the scene with the following parameters:
Using “Medium” preset on Editor.
NumIrradianceCalculationPhotons = 4096 (Fixed) Static Lighting Level = 0.6 NumHemisphereSamples = 64 IndirectPhotonDensity = 3000 IndirectIrradiancePhotonDensity = 1500 IndirectPhotonSearchDistance = 180
It is normal in this part of the process to appear some light/shadows leaks, however what we want here is check the balance of the lighting between the natural lighting (Skylight and Directlight) and artificial lighting (Spotlight and PointLight).
After we have achieved a nice lighting balance, we can move on to the following settings:
Static Lighting Level = 0.4 NumHemisphereSamples = 128 IndirectPhotonDensity = 6000 IndirectIrradiancePhotonDensity = 3000 IndirectPhotonSearchDistance = 180
Finally, we will use the following configuration for the final lighting:
Static Lighting Level = 0.2 (Below that we have not much impact) NumHemisphereSamples = 256 or 512 (above 512 will have not much difference) IndirectPhotonDensity = 12000 (If there are still flickers of artificial lighting, increase this value along with the parameter below) IndirectIrradiancePhotonDensity = 8000 IndirectPhotonSearchDistance = 180 (180 - 240)
With this workflow I was able to eliminate 98% of Lightmass indirect lighting problems. Still, we may experience some lighting problems.
This is still an experimental documentation created by me and UE4Arch company and hopefully in the future there will be other ways to achieve better results and in less time. I hope this helps other Archviz professionals migrating to Unreal Engine 4 and maybe some game creators too.
Visit our Youtube’s Channel to learn more about our work : https://www.youtube.com/channel/UCjpFOf-YWpois6WVG6hqXNQ
In the next part of this article, I will explain how to achieve a good balance beetween natural and artificial lighting, with proper colors and propagation.