Skip to content

SnowMeshDesc

The SnowMeshDesc class is a mesh descriptor that displays snow particle effects. It creates realistic snowfall effects using texture-based point sprites.

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: { x: number, y: number, z: number } | Vector3

Description: Specifies the center position of the snow particle effect in the ECEF coordinate system. You can convert from latitude/longitude using the geodeticToVector3 function.

Example:

import { geodeticToVector3, degreeToRadian, LLE } from "@navaramap/three";
const position = geodeticToVector3(
new LLE(
degreeToRadian(35.67564356091717), // Latitude
degreeToRadian(139.74511454748298), // Longitude
10, // Altitude
),
);
{
position: position,
snow: { ... }
}

Type: boolean

Description: Controls the visibility of the object.

Default: true

Example:

{
visible: false,
snow: { ... }
}

Type: number

Description: Specifies the number of snowflake particles.

Default: 30000

Example:

{
snow: {
particleCount: 3000,
}
}

Type: number

Description: Specifies the distribution radius of the snow.

Default: 10

Example:

{
snow: {
radius: 15,
}
}

Type: number

Description: Specifies the width of the snowfall area.

Default: 500

Example:

{
snow: {
areaWidth: 500,
}
}

Type: number

Description: Specifies the height of the snowfall area.

Default: 1000

Example:

{
snow: {
areaHeight: 1000,
}
}

Type: number

Description: Specifies the falling speed of the snowflakes.

Default: 0.00005

Example:

{
snow: {
speed: 0.001,
}
}

Type: { x: number, y: number, z: number }

Description: Specifies the strength of wind-driven movement of snowflakes for each axis.

Default: { x: 50, y: 20, z: 50 }

Example:

{
snow: {
movementStrength: { x: 0.5, y: 0, z: 0.5 },
}
}

Type: { x: number, y: number, z: number }

Description: Specifies the speed of wind-driven movement of snowflakes for each axis.

Default: { x: 0.0005, y: 0.0002, z: 0.0005 }

Example:

{
snow: {
movementSpeed: { x: 0.001, y: 0, z: 0.001 },
}
}

Type: number

Description: Specifies the size of the snowflakes.

Default: 3

Example:

{
snow: {
size: 0.05,
}
}

Type: number

Description: The color of the snowflakes.

Default: 0xffffff

Example:

import { Color } from "@navaramap/three";
{
snow: {
color: new Color().setStyle("#eeeeff").toHex(),
}
}

Type: number

Description: Specifies the opacity of the snowflakes.

Default: 1

Example:

{
snow: {
opacity: 0.8,
}
}

Type: boolean

Description: Specifies whether the mesh follows the camera.

Default: true

Example:

{
snow: {
followCamera: true,
}
}

Type: number

Description: Specifies the maximum altitude. Opacity decreases proportionally with camera altitude.

Default: 3000

Example:

{
snow: {
maxHeight: 5000,
}
}
import ThreeView from "@navaramap/three";
import { SnowMeshDesc } from "@navaramap/three_default_descs";
const view = new ThreeView();
view.registerMesh("snow", SnowMeshDesc);
await view.init();
// Add a SnowMeshDesc
const snowDesc = view.addMesh<SnowMeshDesc>({
snow: {
particleCount: 3000,
areaWidth: 500,
areaHeight: 1000,
speed: 0.001,
movementStrength: { x: 0.3, y: 0, z: 0.3 },
movementSpeed: { x: 0.0005, y: 0, z: 0.0005 },
size: 0.05,
opacity: 0.8,
followCamera: true,
},
});
import ThreeView, { Color, geodeticToVector3, degreeToRadian, LLE } from "@navaramap/three";
import { SnowMeshDesc } from "@navaramap/three_default_descs";
const view = new ThreeView({ animation: true });
view.registerMesh("snow", SnowMeshDesc);
await view.init();
// Calculate the position of Tokyo
const position = geodeticToVector3(
new LLE(
degreeToRadian(35.67564356091717),
degreeToRadian(139.74511454748298),
10,
),
);
// Add a SnowMeshDesc at a specific position
const snowDesc = view.addMesh<SnowMeshDesc>({
visible: true,
position: position,
snow: {
particleCount: 3000,
speed: 0.001,
color: new Color().setHex(0xffffff).toHex(),
opacity: 0.8,
},
});
// Toggle visibility
snowDesc.visible = false;