Sky Atmosphere

The SkyAtmosphere system is used to create physically-based sky and atmosphere rendering with time-of-day features and ground-to-space view transitions featuring aerial perspective.

Windows
MacOS
Linux

The Sky Atmosphere component in Unreal Engine 4 (UE4) is a physically-based sky and atmosphere-rendering technique. It's flexible enough to create an Earth-like atmosphere with time-of-day featuring sunrise and sunset, or to create extraterrestrial atmospheres of an exotic nature. It also provides an aerial perspective to which you can simulate transitions from ground to sky to outer space with proper planetary curvature.

SkyAtmosphereDayDusk.png

The Sky Atmosphere gives an approximation of light scattering through a planetary atmosphere's participating media, giving outdoor levels a more realistic or exotic look by including the following:

  • You can have two atmospheric Directional Lights that receive sun disk representation in the atmosphere with sky color that depends on the sunlight and atmosphere properties.

  • A sky color that will vary, depending on the altitude of the sun, or in other terms, how close the dominant Directional Light's vector gets to being parallel with the ground.

  • Control over scattering and fuzzy settings, allowing for full control of your atmospheric density.

  • Aerial perspective that simulates the curvature of the world when transitioning from ground to sky to space views.

Enabling the Sky Atmosphere Component

Enable the Sky Atmosphere component by following these steps using the Modes panel in the Level Editor:

  1. Place a Sky Atmosphere component in the scene.

  2. Place a Directional Light in the scene, and from its Details panel, enable Atmosphere/Fog Sun Light.

    1. If using multiple Directional Lights, set the Atmosphere Sun Light Index for each; for instance, 0 for the Sun and 1 for the Moon.

  3. Place a Sky Light in the scene to capture Sky Atmosphere and have it contribute to the scene lighting.

Adjusting Atmospheric Directional Lights

When you've enabled Atmosphere/Fog Sun Light on your Directional Light(s) and set the Atmosphere Sun Light Index for each, you can quickly adjust each light's position using the following keyboard shortcuts:

  • Ctrl + L with mouse movement will adjust the Directional Light set to index 0. Typically this would be the Sun.

  • Ctrl + L + Shift with mouse movement will adjust the Directional Light set to index 1. Typically this would be the Moon.

Moving these light sources will affect the atmosphere based on properties set in the Sky Atmosphere component for each Directional Light.

Sky Atmosphere Model

Simulating the sky and atmosphere in UE4 requires several properties that mimic the look and feel of a real-world atmosphere. These properties can be used to define the look of the sky and atmosphere by scattering light in an appropriate and accurate manner. By default, the Sky Atmosphere component in UE4 represents the Earth.

For an Earth-like planet, the atmosphere is made up of multiple layers of gasses. They themselves are made up of particles and molecules that have their own shape, size and density. When photons (or light energy) enter the atmosphere and collide with the particles and molecules there, they are either scattered (reflected) or absorbed (see below).

ParticleLightInteraction.png

(1) Incident Light from the Sun; (2) Particles in the Atmosphere; (3) Redirected Light Energy.

The Sky Atmosphere system simulates absorption with Mie scattering and Rayleigh scattering. These scattering effects enable the sky to appropriately change colors during time-of-day transitions by simulating how the incident light interacts with particles and molecules in the atmosphere.

The sky color changes depending on the time-of-day simulation when using the Sky Atmosphere component.

Rayleigh Scattering

The interaction of light with smaller particles (such as air molecules) results in Rayleigh scattering. This type of scattering is highly dependent on the light wavelength. For instance, in the Earth's sky, blue scatters more than other colors, giving the sky its blue color during the daytime. However, at sunset, it appears red because light rays need to travel further in the atmosphere. After long distances, all blue light is scattered away before other colors, resulting in colorful sunsets full of yellow, orange, and red colors.

RayleighParticleShape.png

(1) Incident light; (2) Small particles in the atmosphere; (3) Rayleigh scattered light energy.

In an Earth-like atmosphere, when sunlight interacts with small particles (1) in the atmosphere (2), Rayleigh scattering happens throughout the atmosphere. The upper atmosphere is less dense compared to the lower atmosphere near the Earth's surface (3).

RaylightAtmosphereInteraction.png

Increasing or decreasing the density of particles in the atmosphere causes light to scatter more or less.

Drag the slider to see the effects of decreasing and increasing the Rayleigh Scattering Scale. (Left to right, 1–3)

  1. Decreased scattering causes light to scatter less through the atmosphere. This is 10x less dense than Earth's atmosphere.

  2. This is representative of an Earth-like atmospheric density.

  3. Increased scattering allows light to scatter more through the atmosphere. This is 10x more dense than Earth's atmosphere.

Mie Scattering

The interaction of light with larger particles—such as those from dust, pollen, or air pollution—suspended in the atmosphere results in Mie scattering. These particles are referred to as aerosols and can be caused naturally or by human activity. Incident light that follows the Mie scattering theory usually absorbs light, causing the clarity of the sky to appear hazy by occluding light. Light also usually scatters more forward, resulting in bright halos around the light's source, such as around the sun disk in the sky.

MieParticleShape.png

(1) Incident light; (2) Large particles in the atmosphere; (3) Mie-scattered light energy.

Increasing or decreasing the aerosol density causes more or less clarity in the sky, contributing to how hazy it looks.

Drag the slider to see the effects of decreasing and increasing the Mie Scattering Scale. (Left to right, 1–3)

  1. Decreased particle density allows the sky to appear more clearly. It has less haze and light is scattered less directionally.

  2. Default Mie scattering scale.

  3. Increased particle density causes the sky to become occluded. It also causes the sky to appear hazy with the strong forward scattering lob around the incident light direction.

Mie Phase

The Mie Phase controls how uniformly light scatters when interacting with larger aerosol particles in the atmosphere. With Mie scattering, light usually scatters more forward, resulting in bright halos around the light's source, such as around the sun disk in the sky.

MiePhaseFunctionShape.png

(1) Incident Light; (2) Larger particles in the atmosphere; (3) Stronger Mie-scattered light energy.

Use the Mie Anisotropy property to control how uniformly Mie scattering happens across the atmosphere.

Drag the slider to see the effects of decreasing and increasing the Mie Anisotropy of the atmosphere. (Left to right, 1–3)

  1. Decreasing the Mie Anisotropy scatters light more uniformly across the atmosphere. This example is using a value of 0.

  2. Default settings mimic an Earth-like atmosphere. This example is using a value of 0.8.

  3. Increasing the Mie Anisotropy scatters light more directionally causing it to tighten around the light source. This example is using a value of 0.9.

Atmospheric Absorption

The amount and colors absorbed are controlled using the Absorption Scale and Absorption color picker properties. The examples below demonstrate removing a single RGB color through the increased Absorption Scale.

Drag the slider to see the effects of decreasing and increasing the Absorption Scale of the atmosphere. (Left to right, 1-3)

  1. No atmospheric absorption.

  2. Default Earth Ozone absorption scale.

  3. Increased Ozone absorption scale.

The amount and colors absorbed are controlled using the Absorption Scale and Absorption color picker properties. The examples below demonstrate removal of a single RGB color through an atmosphere with increased absorption.

Absorption_GreenRemoved.png

Absorption_RedRemoved.png

Absorption_BlueRemoved.png

Green Absorbed

Red Absorbed

Blue Absorbed

Absorption of some colors may not be as noticeable during different times of day due to the way light scatters through the atmosphere.

Altitude Distribution

The Sky Atmosphere component enables you to control the atmosphere from not only a ground perspective but also from an aerial and space one. This means that you can effectively define the curvature of your world so that transitioning from ground to sky to space feels and looks like a real-world atmosphere.

Use the following properties to achieve this use:

  • Ground Radius to define the planet's size.

  • Atmospheric Height to define the height of the atmosphere above which we stop evaluating light interactions with the atmosphere.

  • Rayleigh Exponential Distribution to define the altitude (in kilometers) at which Rayleigh scattering effect is reduced to 40% due to reduced density.

  • Mie Exponential Distribution to define the altitude (in kilometers) at which Mie scattering effect is reduced to 40% due to reduced density.

Drag the slider to see the effects of decreasing and increasing Rayleigh height of the atmosphere. (Left to right, 1–3)

  1. Rayleigh Atmosphere Height is 0.8 kilometers.

  2. Default Rayleigh Atmosphere Height of 8 kilometers.

  3. Rayleigh Atmosphere Height is 80 kilometers.

Artistic Direction

Additionally, the Sky Atmosphere component supports artistic control when designing the look of your project.

Aerial Perspective Scale

The Aerial Perspective View Distance Scale property scales distances from the view to surfaces to make them look thicker when viewed from a high enough distance above the ground surface.

Drag the slider to change the Aerial Perspective View Distance Scale property. (Left to right, 1-3)

  1. Some atmospheric properties were set up for this scene.

  2. The same scene with the Aerial Perspective View Distance Scale increased slightly.

  3. The same scene with Aerial Perspective View Distance Scale doubled.

Exponential Height Fog

Mie scattering is a component of the atmosphere and is a height fog simulation in itself, meaning you can already use it to create height fog in your scene without using the Exponential Height Fog component (see below).

Sky Atmosphere's Height Fog

Sky Atmosphere | with Exponential Height Fog

Height fog produced from the Sky Atmosphere component without Exponential Height Fog component.

However, if your project requires it, you can enable it from the Project Settings with the Support Atmosphere Affecting Height Fog setting. The contribution is additive on top of the existing fake colors on the height fog itself. The strength of the influence of the sky and sun on the height fog is controllable using the Height Fog Contribution property on the Sky Atmosphere component.

Drag the slider to see the height fog contribution increase and decrease its contribution to the Sky Atmosphere component. (Left to right, 1-3)

  1. Default height fog contribution from the Sky Atmosphere component.

  2. Half height fog contribution (0.5) from the Sky Atmosphere component.

  3. Double height fog contribution (2.0) from the Sky Atmosphere Component.

Sky Rendering Options

The sky and aerial perspective is rendered on screen using ray marching. However, doing so for each pixel can be expensive, especially with today's standard pushing towards 4K or 8K resolution. That is why the sky is evaluated in a few lookup tables (LUTs) at low resolution. Those LUTs are:

By default, all of these LUTs are all evaluated, but using the examples below you can determine the needs for your own projects.

Type of LUT Used

Description

FastSkyViewLUT

Stores a latitude/longitude texture of the ray ray marched sky luminance around a point of view. It is applied on the sky pixels only.

AerialPerspectiveLUT

Stores the transmittance and scattered luminance into froxel (camera frustum voxel). This is used to apply aerial perspective on opaque and transparent meshes**.

MultipleScatteringLUT

During ray marching, used to evaluate the multiple scattering contributions.

TransmittanceLUT

During ray marching, used to evaluate the remaining illuminance from the sun light for any position within the atmosphere and on the planet.

DistanceSkyLightLUT

Stores non-occluded luminance after a scatter event with a uniform phase function.

Many of these settings allow you to control the LUT's performance and visual quality for your project. For additional details about them, see the Sky Atmosphere Reference page.

Rendering the Sky using a Skydome Mesh

For some projects, you will want to position the skydome mesh around the world, enabling artists to control the way the sky is composited with clouds, stars, sun and any other celestial bodies.

To set up a skydome mesh to work with the Sky Atmosphere component, you'll need to set the following in its Material:

  • Blend Mode: Opaque

  • Shading Model: Unlit

The sky material is rendered as the last opaque mesh during the base pass, meaning that aerial perspective will not be applied on it to avoid double contribution. However, height fog and volumetric fog will continue to be applied, if used.

In this material, you will have the freedom to compose the sky, sun disk, clouds and aerial perspective. Also, you will have to compute lighting on the clouds and other elements in the sky. Several Material Expressions can be used to achieve this in your materials. You can find them by searching the term "SkyAtmosphere" in the Material Editor.

Customized Sky Material

When creating your own sky material, which has customized clouds, planets, sun, or other object, you should enable the Is Sky flag in the Material advanced properties. However, keep in mind that it disables contribution from aerial perspective (atmospheric fog) of the Sky Atmosphere component, but does apply height and volumetric fog to the scene from the Exponential Height Fog component.

For additional information about these Material Expressions, see the Sky Atmosphere Reference page.

The shape of the skydome mesh is important when using some of these expressions since they will drive evaluation of those values. For example, if you use the functions to evaluate lighting on clouds, you can assume the skydome pixel world position represents the cloud world position in the atmosphere.

Time of Day Example Level

A working example template map demonstrating a skydome mesh with a material using the Sky Atmosphere Material Expressions is available with UE4.

SkyAtmos_TimeOfDayMap.png

This Level is located in the Engine Content folder under Engine/Maps/Templates, or you can use the main menu to create a new level and select the TimeOfDay_Default Level.

Planetary Atmospheres Viewed from Space

In addition to creating beautiful atmospheres from a planet's surface, the Sky Atmosphere system is capable of creating a planetary atmosphere viewed from space. Without any special setup, you can even move seamlessly from the planet's surface through the atmosphere to outer space.

This video uses assets and materials that are not part of the Sky Atsmosphere system, such as the star field and meshes that represent the planet surface.

The following properties are useful when setting up a planet to be viewed from outer space (or even just a very high altitude):

  • Ground Radius define the size of your planet (measured in kilometers).

  • Atmosphere Height defines the height of the atmosphere above the planet's surface (measured in kilometers).

  • Rayleigh Exponential Distribution defines the altitude at which the Rayleigh effect is reduced to 40%.

Below are some examples using demonstrating different planetary atmospheres using variations of these three properties:

Ground Radius: 6360 km

Ground Radius: 300 km

Ground Radius: 300 km

Ground Radius: 300 km

Ground Radius: 300 km

Atmosphere Height: 100 km

Atmosphere Height: 100km

Atmosphere Height: 100 km

Atmosphere Height: 100 km

Atmosphere Height: 300kn

Rayleigh Distribution: 8 km

Rayleigh Distribution: 8 km

Rayleigh Distribution: 2 km

Rayleigh Distribution: 32 km

Rayleigh Distribution: 32 km

Click images for full size.

Moving the Atmosphere

The Sky Atmosphere component is freely movable within Level using the selectable Transform Mode. Choose from the following options:

  • Planet Top at Absolute World Position places the top ground level of the atmosphere at the world origin coordinates (0,0,0) in the scene. The Sky Atmosphere is not movable when this option is selected.

  • Planet Top at Component Transform places the top ground level of the atmosphere relative to the component's transform origin. Moving the transform of the Sky Atmosphere component, or one that it is a child of, moves the atmosphere within the level.

  • Planet Center at Component Transform places the atmosphere centered to the component's transform origin. Moving the transform of the Sky Atmosphere component, or one that it is a child of, moves the atmosphere within the level.

The Sky Atmosphere component can be parented to objects in the scene, such as a planet mesh.

Atmosphere Transmittance

Transmittance is optimized for ground-level views: a single transmittance is evaluated for the top of the plance, but for a planetary view, you want the transmittance to be evaluated per pixel for the atmosphere terminator to look correct, as well as for the atmosphere to cast shadow on nearby moons.

Transmittance: | Look-up Table (LUT)

Transmittance: | Per Pixel

Per pixel atmospheric transmittance also allows for shadowing of other objects in outer space (such as a moon or other nearby celestial body) according to properties set on the Sky Atmosphere component.

Transmittance Disabled

Transmittance Enabled

Set the console command r.SkyAtmosphere.TransmittanceLUT.LightPerPixelTransmittance to 1 to enable per pixel transmittance, allowing for the light terminator on a planet to look correct and cast a shadow.

Moving from Ground to Outer Space

The Sky Atmosphere system is optimized for scenes that are on ground level. However, there is nothing preventing you from traveling from the ground to a high aerial view, or even outer space. While the transition through the atmosphere should be seamless—without a noticeable transition—from the look-up tables (LUTs) to per pixel tracing, you may sometimes experience a hitch or when this happens.

This optimization can be disabled by setting the following console command values to 0:

  • r.SkyAtmosphere.FastSkyLUT

  • r.SkyAtmosphere.AerialPerspectiveLUT.FastApplyOnOpaque

Once disabled, it is worth noting that you may encounter the following issues. These are some suggestions to help you work around them for your project to find a balance that best fits your project.

  • A high frequency pattern can become visible when it should be absorbed by temporal anti-aliasing (TAA). However, when moving the camera very fast, there is a camera cut that happens—restarting TAA—so it is visible in space views.

  • Due to the way samples count is based on distance, samples become visibly large (as circles) in the atmosphere. Visibility of the samples is a side-effect of the density of medium in the atmosphere being higher, and very concentrated, close to the ground, which is a typical ray marching issue. You can solve this in a couple of ways:

    • Trade performance for quality increase by increasing the number of samples with r.SkyAtmosphere.SampleCountMax or r.SkyAtmosphere.DistanceToCountMax.

    • Set up logic to adjust and tweak atmospheric properties when in outer space to have less particles near the ground, making them more uniform and height distributed.

Visualization and Debugging

The Sky Atmosphere visualization and debugging view enables you to see—in real time—the changes you make to the atmosphere settings.

SkyAtmosVisualization.png

  1. The Hemisphere View shows a visual representation of your atmosphere, taking into account Rayleigh and Mie scattering along with Absorption.

  2. The Time-of-Day Preview displays different times of day based on the settings that are applied to the Sky Atmosphere component.

  3. The Graph View shows a representation of Rayleigh, Mie, and Absorption values within the Sky Atmosphere component's set Ground Level and Atmosphere Height.

Enable the Sky Atmosphere visualization to be drawn on screen using the command:

r.SkyAtmosphere.Visualize 1

Additional Information

  • Setting up Physically-Based Sky Lighting

    • When the sun is at its zenith, it should be set to 120000 lux (or cd:sr*m^2) for an angular diameter of 0.545 degrees.

    • The total Lux on a white diffuse surface with a perpendicular sun at its zenith should be around 150000 Lux.

      • Sky contribution would be 20% of that total.

      • Disable Ambient Occlusion when measuring this value in the Engine using the luminance/illuminance meter that is available in the HDR (Eye Adaptation) Visualization tool (Show > Visualize).

      • Multiscattering in the Sky Atmosphere component should be equal to 1 and Earth Albedo is 0.4 (linear) by default.

    • When the moon is at its zenith, it should be set to 0.26 Lux for an angular diameter of 0.568 degrees.

  • Why does the ground/lower hemisphere appear dark?

    When you are close to the ground, there isn't any fog, so you don't get the scattering effect nor any fog color. This means for the lower hemisphere of a virtual planet, it is black. To address this, try the following:

    • Populate the scene with a terrain or mesh to represent the planet surface.

    • Use an Exponential Height Fog component as a lower hemisphere color filler.

    • Place your terrain or mesh surface at a higher altitude.

  • Why does the second Directional Light source have a lower impact on the sky?

    Currently, multi-scattering is not evaluatated for the second light source.

  • Why are texels are visible on the skydome?

    Try increasing the resolution of the FastSkyViewLUT (r.SkyAtmosphere.FastSkyViewLUT.SampleCountMax) if texels appear on the sky. If texels appear on fogged elements, increase the resolution of the AerialPerspectiveCameraVolumeLUT (r.SkyAtmosphere.AerialPerspectiveLUT.DepthResolution).

  • Do atmospheric lights work when the camera is not close to the +Z North Pole of the planet?

    As an optimization, sun light transmittance effect on surface lighting is only evaluated as if the camera is at the top of the planet (over +Z position). This will be improved in a future release based on feedback.

  • Can you render multiple planetary atmospheres on screen at once?

    This is not currently supported with this version of the Sky Atmosphere system.

  • Noise, aliasing, and some rings of different colors are visible

    When you have high-frequency elements or values that generate high spikes in the atmosphere close to the ground that are hard to catch, resolve this using one of two ways:

    • Increase the Sky Atmosphere sample count using r.SkyAtmosphere.SampleCountMax.

    • If you're using the FastSky LUT instead of per-pixel ray marching, use r.SkyAtmosphere.FastSkyLUT.SampleCountMax. Additional details can be found in the Sky Rendering Options section above.

Special Thanks

Thank you to Quixel for the assets and materials from their Megascanes library used to create the planet surface, and to Epic's own Sjoerd de Jong for his Sky Atmosphere demonstration project shown throughout this page.

Additional Resources

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback