Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eliminate DirectionalLight Spot #151

Open
MichaelBonnet opened this issue Sep 8, 2023 · 1 comment
Open

Eliminate DirectionalLight Spot #151

MichaelBonnet opened this issue Sep 8, 2023 · 1 comment

Comments

@MichaelBonnet
Copy link

In this example, the DirectionalLight in the scene casts an effective hemispheric shadow, which is good in my case. However, it also casts a very visible bright spot over the point it is shining. This occurs even at low intensity and low differential between DirectionalLight and AmbientLight. Is there a way to change how the light is "focused", per se, such that the focused spotlike-ish area either doesn't exist, or doesn't illuminate the center so intensely?

@vasturiano
Copy link
Owner

@MichaelBonnet you can access the existing lights via the scene() method . There is an ambient light and a directional light added by default. To access these:

const globeAmbientLight = globeRef.current.scene().getObjectByProperty('isAmbientLight', true);
const globeDirectionalLight = globeRef.current.scene().getObjectByProperty('isDirectionalLight', true);

At this point you can change the settings of either of these two lights. You can follow the ThreeJS docs for AmbientLight and DirectionalLight.

For your use case you can try playing with the directional light intensity, position (directly above the north pole by default) or where it's pointed at via the target (downwards at the globe by default).

In addition, you can add more lights to the scene, f.e. via scene().add(new THREE.SpotLight()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants