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.
Properties
Section titled “Properties”visible
Section titled “visible”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, }}moonScale
Section titled “moonScale”Type: number
Description: Specifies the scale of the moon.
Default: 1
Example:
{ sky: { moonScale: 1.5, }}moonIntensity
Section titled “moonIntensity”Type: number
Description: Specifies the brightness of the moon.
Default: 1
Example:
{ sky: { moonIntensity: 0.8, }}sunAngularRadius
Section titled “sunAngularRadius”Type: number
Description: Specifies the angular radius of the sun in radians.
Default: 0.004675
Example:
{ sky: { sunAngularRadius: 0.005, }}envMap
Section titled “envMap”Type: boolean
Description: Specifies whether to render as an environment map.
Default: false
Example:
{ sky: { envMap: true, }}Usage Examples
Section titled “Usage Examples”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 SkyMeshDescconst skyDesc = view.addMesh<SkyMeshDesc>({ sky: { visible: true, sun: true, moon: true, moonScale: 1.2, moonIntensity: 0.9, sunAngularRadius: 0.004675, },});Technical Details
Section titled “Technical Details”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.