Lighting ( OccViewer.Lights) in LWV plays a crucial role in enhancing the visual representation of 3D models. The framework offers a flexible and powerful system to define and control various types of light sources. Below is an overview of the key features and parameters associated with lights in LWV.
Types of Light Sources:
Light Parameters ( OccViewer.WasmLightParams):
Usage and Management Light sources can be created and managed using the LightsController( OccViewer.LightsController) class in conjunction with the lights property of the viewer. This allows dynamic updates to the lighting setup, enabling developers to create highly realistic scenes with minimal effort.
// getting all automatically added lights
const aLightList = OccViewerModule.lights.getLights();
// add a new light
OccViewerModule.lights.addLight(
{
angle: 0,
color: '#FFFFFF',
dir: {x: 0.0, y: 0.0, z: -1},
intensity: 20.0,
isHeadlight: false,
name: 'light_' + Date.now(),
position: {x: 0, y: 0, z: 0},
range: 0,
toCastShadows: true,
type: OccViewerModule.Graphic3d_TypeOfLightSource.DIRECTIONAL,
},
true,
);