Skip to content

SkyMeshDesc

The SkyMeshDesc class is a mesh descriptor that draws the sky, sun, and moon using atmospheric scattering. It provides realistic sky rendering using physics-based atmospheric scattering simulation.

The sun and moon positions are automatically calculated based on view.atmosphere.date and updated every frame.

In addition to the properties below, the common properties from the base class (position, rotation, scale, matrix, matrixWorld, visible) are available. See MeshDesc for details.

Type: boolean

Description: Toggles the visibility of the sky mesh.

Example:

{ visible: true }

Type: boolean

Description: Specifies whether to display the sun.

Default: true

Example:

{
sky: {
sun: true,
}
}

Type: boolean

Description: Specifies whether to display the moon.

Default: true

Example:

{
sky: {
moon: true,
}
}

Type: number

Description: Specifies the scale of the moon.

Default: 1

Example:

{
sky: {
moonScale: 1.5,
}
}

Type: number

Description: Specifies the brightness of the moon.

Default: 1

Example:

{
sky: {
moonIntensity: 0.8,
}
}

Type: number

Description: Specifies the angular radius of the sun in radians.

Default: 0.004675

Example:

{
sky: {
sunAngularRadius: 0.005,
}
}

Type: boolean

Description: Specifies whether to render as an environment map.

Default: false

Example:

{
sky: {
envMap: true,
}
}
import ThreeView from "@navaramap/three";
import { SkyMeshDesc } from "@navaramap/three_default_descs";
const view = new ThreeView();
view.registerMesh("sky", SkyMeshDesc);
await view.init();
// Add a SkyMeshDesc
const skyDesc = view.addMesh<SkyMeshDesc>({
sky: {
visible: true,
sun: true,
moon: true,
moonScale: 1.2,
moonIntensity: 0.9,
sunAngularRadius: 0.004675,
},
});

SkyMeshDesc is implemented using the @takram/three-atmosphere library and provides the following features:

  • Physics-based atmospheric scattering simulation
  • Dynamic lighting based on sun and moon positions
  • Sky color changes according to time of day
  • Atmospheric shadow length calculation

The sky mesh is automatically updated based on camera orientation and always covers the entire viewport.