Add a sun the "global way", having effect on all the models

Hi everybody,

I am working on a little runner-game made with three; i already asked last week how to generate a procedural terrain, now I would like to “light” it.
I’ve got some problems that I think are more related to my still low understanding of how the lights work.
I’ve got scene with :

What i’d like to is to make water light and terrain light match :

I already tried it several times, the roughness property, and I also moved standardmaterials to physicalmaterials, in order to use reflectivity.

I used an organisation as in the codepen above, because functions are quite easy to find.

My three sky is in a function : is it possible that it won’t work because models and objects are in other functions - I didn’t manage to separate water from the skybox yet but I think It’s because I’m a newbie.

My question is the folowing : how to create properly a skybox that affects all my models ? Does the skybox affects the models, or are the models affected by the skybox ?

Where should I search ?

Here is my file : app.js (6.4 KB)

Thanks a lot by advance :slight_smile: !

I managed to do it ! I’ll then try to close the topic. It was quite easy though, sorry for the lean topic !

Can you share the solution here, if you think it might be useful for other people?


Hi @looeee ! I’ll do that as soon as possible but I’d prefer to be sure of what I write as people here are true experts… and I’m not yet.