From 77ca97dda2ae4d4176745bdde147ae2a2d341d16 Mon Sep 17 00:00:00 2001 From: ppillot Date: Thu, 11 Apr 2024 09:47:39 -0400 Subject: [PATCH] Adjust default light intensity Changes in Three.js regarding light computation even with the `renderer.useLegacyLights` parameter enabled. --- examples/js/gui.js | 4 ++-- src/stage/stage.ts | 11 ++++++----- src/viewer/viewer.ts | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/js/gui.js b/examples/js/gui.js index 27a34b814..cf57dcaff 100644 --- a/examples/js/gui.js +++ b/examples/js/gui.js @@ -105,9 +105,9 @@ NGL.Preferences = function (id, defaultParams) { cameraFov: 40, cameraType: 'perspective', lightColor: 0xdddddd, - lightIntensity: 1.0, + lightIntensity: 1.2, ambientColor: 0xdddddd, - ambientIntensity: 0.2, + ambientIntensity: 0.3, hoverTimeout: 0 } diff --git a/src/stage/stage.ts b/src/stage/stage.ts index 30e770434..f313f7073 100755 --- a/src/stage/stage.ts +++ b/src/stage/stage.ts @@ -47,6 +47,7 @@ import Surface from '../surface/surface' import Volume from '../surface/volume' import Shape from '../geometry/shape' import Script from '../script' +import { GenericColor } from '../types' function matchName (name: string|RegExp, object: { name: string }) { if (name instanceof RegExp) { @@ -123,7 +124,7 @@ export const StageDefaultParameters = { quality: 'medium' as RenderQualityType, workerDefault: true, sampleLevel: 0, - backgroundColor: 'black' as string|number, + backgroundColor: 'black' as GenericColor, rotateSpeed: 2.0, zoomSpeed: 1.2, panSpeed: 1.0, @@ -137,10 +138,10 @@ export const StageDefaultParameters = { cameraFov: 40, cameraEyeSep: 0.3, cameraType: 'perspective' as 'perspective'|'orthographic'|'stereo', - lightColor: 0xdddddd as string|number, - lightIntensity: 1.0, - ambientColor: 0xdddddd as string|number, - ambientIntensity: 0.2, + lightColor: 0xdddddd as GenericColor, + lightIntensity: 1.2, + ambientColor: 0xdddddd as GenericColor, + ambientIntensity: 0.3, hoverTimeout: 0, tooltip: true, mousePreset: 'default' as MouseControlPreset diff --git a/src/viewer/viewer.ts b/src/viewer/viewer.ts index afaff7764..7f50e6563 100644 --- a/src/viewer/viewer.ts +++ b/src/viewer/viewer.ts @@ -320,9 +320,9 @@ export default class Viewer { clipScale: 'relative', lightColor: new Color(0xdddddd), - lightIntensity: 1.0, + lightIntensity: 1.2, ambientColor: new Color(0xdddddd), - ambientIntensity: 0.2, + ambientIntensity: 0.3, sampleLevel: 0,