code is :
const BACKGROUND_COLOR = 0xffffff;
initScene(): void {
this.scene.background = new Color(BACKGROUND_COLOR);
this.scene.castShadow = true;
this.scene.receiveShadow = true;
}
initLights(): void {
let dirLight = new DirectionalLight(LIGHT_CLR, 2);
dirLight.position.set(5.02, 8.539, 4.129);
dirLight.castShadow = true;
dirLight.shadow.mapSize = new Vector2(1024, 1024);
this.scene.add(dirLight);
}
setupRenderer(): void {
this.renderer = new WebGLRenderer({
antialias: true,
alpha: false,
powerPreference: 'high-performance',
precision: 'highp',
preserveDrawingBuffer: true,
});
this.renderer.shadowMapType = PCFSoftShadowMap;
this.renderer.shadowMap.enabled = true;
this.renderer.setPixelRatio(window.devicePixelRatio);
this.renderer.setSize(
parseInt(this.canvas.style.width),
parseInt(this.canvas.style.height)
);
}