vasturiano / 3d-force-graph

3D force-directed graph component using ThreeJS/WebGL
https://vasturiano.github.io/3d-force-graph/example/large-graph/
MIT License
4.67k stars 825 forks source link

Issue with scene hyper-intensive illumination (probably after 1.73.0) #651

Closed alexanderevgrafov closed 11 months ago

alexanderevgrafov commented 11 months ago

Sympthoms: All nodes in the scene looks flat, e.g. no shades applied, only flat bright colours. This happens despite Lambert Material is used for node geometry. Applying very dark colours to nodes materials helps to return shading on display.

This is seems caused by ForceGraph internally creates default scene lights(Ambient+Directional) with intensity===Math.PI. Not sure why PI is used, but ThreeJS suggests default intensity values===1.

Explicit add of two (expected) default lights with 'normal' intensities helped in my case

 .lights([
            new Three.AmbientLight(0xcccccc, 1),
            new Three.DirectionalLight(0xffffff, 0.6),
          ])
vasturiano commented 11 months ago

@alexanderevgrafov which version of three do you have in your dependency tree? If it's prior to 0.155 that's possibly the culprit, because that's the release where the internal behaviour of the lighting has changed. Here's more info: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733

alexanderevgrafov commented 11 months ago

Yep, seems you nailed the problem, my three is older. Thank you very much for quick answer, now i'm armed with knowledge before next libs upgrade!