3D Scene Lighting
SciChart3DSurface combines an ambient fill light with one main directional light. Ambient light keeps shadowed faces visible; the directional light reveals the shape of surface meshes, columns, and other lit 3D geometry.
Interactive lighting controls
The scene below contains both a surface mesh and columns. Adjust ambient intensity, choose how the main light is positioned, and—when using global space—adjust its X, Y and Z direction.
Configure lighting when creating the surface
Set ambientLight from 0 (no fill) to 1 (the default ambient level). Use GlobalSpace when a fixed direction is wanted, or CameraForward when the light should follow the camera.
- TS
const { sciChart3DSurface, wasmContext } = await SciChart3DSurface.create("scichart-root", {
theme: new SciChartJsNavyTheme(),
worldDimensions: new Vector3(220, 130, 220),
lighting: {
ambientLight: Number(ambient.value), // global ambient light
lightDirection: new Vector3(-0.25, 0.5, -0.25), // directional light
lightMode: EMainLightMode.GlobalSpace,
},
cameraOptions: {
position: new Vector3(-210, 170, 240),
target: new Vector3(0, 55, 0)
}
});
Update the light at runtime
The lightingController redraws the scene when its settings change. setLightDirection() is relevant only in GlobalSpace; direction is normalized here so the sliders change direction rather than brightness.
- TS
// setting amibent light:
sciChart3DSurface.lightingController.ambientLight = Number(ambient.value);
// setting the directional light mode and direction:
sciChart3DSurface.lightingController.lightMode = mode;
sciChart3DSurface.lightingController.setLightDirection(
new Vector3(x / length, y / length, z / length)
);
Choosing a light mode
GlobalSpace: the direction is fixed in the 3D world. Use this for a consistent studio-style light.CameraForward: the light follows the camera, which is useful when orbiting a scene for inspection.None: disables the directional light; ambient light still applies.
Start with low ambient light (around 0.1–0.25) and a diagonal global direction. High ambient intensity flattens contrast and makes surface shape harder to read.