March 22nd, 2019
Physically-based rendering has become a standard technique in game development. It provides a simple way to make a materials based on physical parameters like Roughness and Metallic, and which you don't need to modify to look good in different lighting conditions.
A similar physically based approach to light sources is less common. Without this, artists have to pick arbitrary brightness and exposure values and adjust them until they "look right". Image-based lighting captured from photography is a step towards a solution, but doesn't solve the problem for manually placed light sources.
It doesn’t have to be this way. Since version 4.19, UE4 has supported real-world lighting units and real-world photography exposure units, so you can set up lighting based on real-world brightness. This makes it much easier to achieve the immersive lighting results you want, without having to tweak the lighting every time you make a change.
Imagine a scene with a sun and a lamp. The traditional approach would be to have the sun deliver, say, four times more light than the lamp. That might look OK.
But now imagine we add five more lamps. Suddenly, the lamps are providing more light than the sun. That doesn’t look right — so we adjust the lamp intensity and tweak the scene exposure settings to balance everything out. This means tweaking all the light sources in the scene every time we add a light source.
The problem is that the brightness of these light sources is not physically realistic. In reality, the sun delivers about 60 times more light than a typical lightbulb. Instead, by using realistic brightness for the sun and lamps, we don’t need to tweak the lighting again every time we add or remove lamp.
To use physically realistic lighting in UE4, just use real-world units for your light sources. As of version 4.19, UE4 supports real-world lighting units: lumen, candelas, and lux.
For example, let’s say we want to create a scene with bright sunlight. In the real world, sunlight delivers about 120,000 lux. Set the brightness of the sun in your game to 120,000 lux, and voila — your sunlight matches reality.
Candela and lumen ratings for real lights are freely available. For example, the image below comes from the Jackson LED shopping guide. There are some more sources at the end of this post.
Lumen, candelas and lux are standard (SI) units, similar to centimeters, kilograms, or seconds.
Lumen measure luminous flux. This the overall power of a light source — the sum of all the light it emits in every direction.
Candelas measure luminous intensity. This is the power of a light source in one direction. This might change depending on the direction you’re measuring from — for example, a spotlight gives out a lot of light in one direction, but less light in other directions.
Lux measure how much a surface is illuminated by the light.
Lumens, candela and lux are all defined in terms of each other. A light source with a power of one lumen, which emits light uniformly an area of one square meter at a distance of one square meter, has an intensity of one candela. The illumination of a surface at a distance of one meter from this light source is exactly one lux.
For example, a 1000-lumen light that emits light uniformly in all directions has an intensity of around 80 candela. The illumination of a surface at a distance of one meter from this light source is also around 80 lux.
When you focus this 1000-lument light in a beam, the candela intensity is much larger than when the light is emitted uniformly in all directions. When the light’s power is focused into around 8% of the area, its intensity becomes 1000 candela. The illumination of a surface at a distance of one meter from this light source increases by the same proportion to 1000 lux.
Sometimes it’s useful to know the math behind the standard lighting units. (Don’t worry — if you don’t like numbers, you can skip this section.)
One lumen is defined as one candela over one unit area solid angle. This can be expressed as $$lm = cd \cdot sr$$, where lm
is lumens, cd
is candelas, and sr
is steradians
where lm is lumens, cd is candelas, and sr is steradians.
A full sphere is made up of 4pi steradians, so a point light with a luminous intensity of one candela has a luminous flux of 12.57 lumens: $$1 \mathrm{(cd)} \cdot 4\pi \mathrm{(sr)} = 4\pi \mathrm{(cd \cdot sr)} = 12.57 \mathrm{(lm)}$$
If you know how many candelas your light has, and how far it is from a surface, you can calculate the illumination on that surface (its lux) with the following equation:
$$ I \cdot \cos(\theta) \over D^2$$
For this example, we used the free Reflections map from the UE4 Learning Section.
First, we removed all the static lighting and ran the Enlighten precompute. These are the first steps in preparing your level for Enlighten lighting.
Next, we added a Directional Light to act as the sun, then added a global Post-Process volume to establish the initial exposure. We removed extra lighting effects, such as bloom and vignette, because we don't want them interfering with our initial lighting setup – we can re-add these later, once we’re happy with our baseline.
We disabled the Eye Exposure correction (Unreal docs) and specified an exposure (Wikipedia) of EV7. This is because we want to understand the true effect of our lighting. For example, if we double the intensity of the sun, we expect it to be twice as bright; but if the exposure is automatic, the image will adjust itself to compensate for the brighter light. This can be misleading.
We set the directional light to use three different intensity values: 20,000 lux, 50,000 lux, and 165,000 lux. These are realistic values for outdoor illuminance at various times of day. Because Enlighten supports floating point lightmaps, we can use really big numbers like these and still get great results. The screenshots below show the level with these different values:
This is a great start. From here, we can add artificial light sources such as lamps and give them realistic brightness values, and they'll always affect the lighting in a way we can predict.
At GDC 2018, we demonstrated an open-world level which takes advantage of real-world lighting units. The scenes range from bright midday sun to a lava-filled gorge. All the indirect lighting was created with Enlighten.
As the demo cycles through different times of day, we used different brightness values for the sun and moon across different times of day and night. We also used a Sky Light to fill in shaded areas and add color saturation to match the sky color.
One of the challenges was balancing our physically based lighting with other effects, such as atmospheric scattering, god rays, and fog, which don’t use a physically based lighting model. Atmospheric scattering is particularly tricky as, by default, it’s configured for use with different light intensity numbers than found in the real world. But once you set up your lighting with real-world numbers, you can experiment with the other effects until you get the right effect.
The moon is the main light source for the night scenes. In real life, the moon produces around 0.25 lux on on a clear night, compared with the 20,000—120,000 lux produced by the sun. That’s pretty dark.
This is one situation where we don’t want to use a real-world brightness value — it would produce a dark, boring scene. Instead, we boosted the indirected lighting to add visual interest, and boosted the lighting uniformly across the various light sources (moon, skylight, etc) so that their relative relationships remained intact.
This is the real point of using real-world values: not to chase realism for realism’s sake, but to provide a starting point that’s easy to tweak, even if you’re going for something less realistic. And because Enlighten lets you adjust lights in real time, it's a great way to learn through iteration and experimentation.
You can use these real-world values for the lights in your game.
Source: New England Light Pollution Advisory Group
Lamp type | Watts | Lumens (expressed per model) |
---|---|---|
Incandescent frosted | 100 | 1690 |
Incandescent flood | 120 | 1500 |
Quartz-halogen frosted | 300 | 6000 |
Quartz-halogen mini-flood | 50 | 895 |
Fluorescent | 22 | 1200 |
Low-pressure sodium | 90 | 13500 |
High-pressure sodium | 150 | 16000 |
Source: Wikipedia Daylight article
Illuminance | Example |
---|---|
120,000 lux | Brightest sunlight |
111,000 lux | Bright sunlight |
20,000 lux | Shade illuminated by entire clear blue sky, midday |
1,000 - 2,000 lux | Typical overcast day, midday |
<200 lux | Extreme of thickest storm clouds, midday |
400 lux | Sunrise or sunset on a clear day (ambient illumination) |
40 lux | Fully overcast, sunset/sunrise |
<1 lux | Extreme of thickest storm clouds, sunset/rise |
Source: Wikipedia Moonlight article
Illuminance | Example |
---|---|
<1 lux | Moonlight, clear night sky |
0.25 lux | A full moon, clear night sky |
0.01 lux | A quarter moon, clear night sky |
0.002 lux | Starlight, clear moonless night sky |
by Ryan Jones, Silicon Studio Corporation
Mizuchi is a 3D CG rendering engine that aims to achieve
the highest quality in real-time visuals.
Mizuchi Official Site
YEBIS is the only post-effects middleware technology in the world that allows you to utilize various effects in post process with live action video or CG real-time visuals.
YEBIS Official Site
Free Trial / Purchase / Inquiry
■Contact Form
■Contact Number
TEL +81-3-5488-7481