Skip to content

AmbientLightDesc

The AmbientLightDesc class represents an ambient light descriptor that illuminates the entire scene uniformly. AmbientLight illuminates all objects evenly and does not cast shadows.

Type: boolean | undefined

Description: Controls the visibility of the object.

Default: true

Example:

{
visible: false,
ambient: { ... }
}

Type: object | undefined

Description: Configuration options for the ambient light.

Type: Color | undefined

Description: Specifies the color of the ambient light using a Color object.

Default: new Color().setHex(0xffffff)

Example:

import { Color } from "@navaramap/three";
{
ambient: {
color: new Color().setHex(0xffffff),
}
}

Type: number | undefined

Description: Specifies the intensity of the ambient light. Higher values result in brighter light.

Default: 1

Example:

{
ambient: {
intensity: 1.0,
}
}
import ThreeView, { Color } from "@navaramap/three";
import { AmbientLightDesc } from "@navaramap/three_default_descs";
const view = new ThreeView();
await view.init();
// Add an ambient light descriptor
const ambientLight = view.addLight<AmbientLightDesc>({
ambient: {
color: new Color().setHex(0xffffff),
intensity: 1.0
}
});
// Update the ambient light color and intensity
ambientLight.update({
ambient: {
color: new Color().setHex(0xaabbcc),
intensity: 0.5
}
});
// Add ambient light with default settings
view.addLight<AmbientLightDesc>({
ambient: {}
});
// Add ambient light in a hidden state, then toggle visibility later
const ambientLightDesc = view.addLight<AmbientLightDesc>({
visible: false,
ambient: {
intensity: 1,
color: new Color().setHex(0xffffff),
},
});
// Toggle visibility
ambientLightDesc.visible = true;
  • Ambient light does not cast shadows.
  • Ambient light illuminates objects evenly from all directions.
  • It can be used in combination with other light types (SunLightDesc, SkyLightProbeDesc, etc.).
  • If the ambient light intensity is too high, the scene may appear flat.