How to dynamically adjust the light position

How to automatically calculate the position and intensity of light when different 3D models are rendered in the same scene

This question is stated in a way that it is hard to answer. Generally, position and intensity of light affect the artistic impression, so it is up to the designers to decide what effect they want to achieve … and only after this they can think of how to find appropriate values for position and intensity.

Consider a 3D forest. The light could be a strong directional light way above the forest, simulating the sun. It could also be a point light with oscillating intensity, simulating a fireplace in the forest. It could also be a moving narrow spot light simulating a person with an electric torch walking in the forest. And it could also be some ambient light to improve a simulation of fog.

Thank you for your reply. I may not have described the problem clearly.
My requirements are similar to the following website, after loading the model,it can automatically adapt to an initial light position, so that the model can be clearly displayed. If you change the model, the position of the lights will change to make it easier to show the details of the model.


Is there any good scheme to realize this function?

thanks a lot

Consider not using lights at all - instead use HDRI / IBL texture (you load them using RGBELoader and set them as scene.environment)

Sample code in the bottom right: EnvAI - AI-generated high quality environmental maps & IBLs for Three.js

You can get free environment textures from places like HDRIs: Night • Poly Haven

I often do a dynamic directional light, which is always positioned where the camera is. In this way, in any rotation of the scene or motion of the view point, the light will always be frontal to the objects. See line 68 in the following example (and remove the line to see the difference):

light.position.copy( camera.position );

https://codepen.io/boytchev/full/RweQRrX

image

I really appreciate your help,I’ll try

I really appreciate your help, I’m going to try this

1 Like