Atmospheric effects with Giro3D

By Thursday December 12th, 2024NewsFR

This article concerns features under development and subject to change.

As part of the development of Giro3D's globe mode (see our article), let's take a closer look at the atmospheric effects offered alongside the new Globe entity: Glow, Atmosphere, and SkyDome.

👉 These three entities are completely independent of the Globe entity (and all other Giro3D entities), so they can be used in scenes without any globe (e.g., by replacing globes with simple colored spheres).

The Glow Entity

This entity is used to represent a simple spherical light halo. It can depict light-emitting objects (like the Sun) or a highly simplified atmosphere (in terms of required graphical computing power). It is unaffected by the scene's lighting.

const SUN_RADIUS = 696_340_000;

const glow = new Glow({
    color: '#ff7800',
    ellipsoid: Ellipsoid.sphere(SUN_RADIUS),
});
Creating a light halo the size of the Sun
The Sun globe alone

The Sun globe alone

The Sun halo alone

The Sun halo alone

Globe and halo combined

Globe and halo combined

The Atmosphere Entity

This entity is used to accurately represent an atmosphere as seen from space. It requires the Sun's position to function, provided via the method Atmosphere.setSunPosition().

const atmosphere = new Atmosphere({ ellipsoid: Ellipsoid.WGS84 });

const sunLatitude = 5;
const sunLongitude = 45;

const sunPosition = Ellipsoid.WGS84.toCartesian(
    sunLatitude,
    sunLongitude,
    50_000_000,
);

atmosphere.setSunPosition(sunPosition);
Creating an atmosphere around the Earth
The Atmosphere entity combined with a simple blue sphere

The Atmosphere entity combined with a simple blue sphere

Once combined with a Globe configured with appropriate image layers, here is the result:

Earth globe and atmosphere combined

Earth globe and atmosphere combined

The SkyDome Entity

This entity is the counterpart of the Atmosphere entity but viewed from the inside. It represents Rayleigh scattering, i.e., the scattering of sunlight in the sky (which gives the sky its color). The solar disc is also faithfully represented according to the Sun's apparent position relative to the horizon.

const skyDome = new SkyDome();
instance.add(skyDome);

atmosphere.setSunPosition(sunPosition);
Adding a _SkyDome_ to the Giro3D instance
A twilight scene

A twilight scene

A later time of day

A later time of day

Conclusion

Combined with dynamic lighting and cast shadows, these three new entities allow users to create stunning realistic scenes, from local scale to the scale of the solar system.