Why lights dont work for me

I began learning Three js and it has been bothering me that some of the lights does not work for me. While following a tutorial on Youtube (https://www.youtube.com/watch?v=XXzqSAt3UIw&list=PLjcjAqAnHd1EIxV4FSZIiJZvsdrBc1Xho&index=2), everything works fine except for the lights that are supposed to illuminate the planets (like in the video at 4:21). When I tested it out, there is not even the faintest light illuminating any planets.

I thought maybe is a syntax error so I tried copying and pasting the code from the video’s src file (solarsystem/src/js/scripts.js at 2eea63bba50cbba3e1fb452ec3483b14ff61088a · WaelYasmina/solarsystem · GitHub) and run it but the problem persists. Why is that light dont work properly for? Thanks.

I am not sure if the video is outdated and subject to new changes. If so how should I edit it so that I can at least see some lights in my scene. Thanks.

Let’s get your code out there, There’s a good chance the lights didn’t work

const pointLight = new THREE.PointLight(0xFFFFFF, 2, 300);

In physically-based units, an intensity of 2 is similar to 2 candles. At a distance of 300m, it won’t do much. You could either vastly increase the intensity (I recommend setting up lil-gui or similar to make this easier), or decrease the decay property from the physically-based default to 0 or 1. If you look at the first comment on the Youtube video, there are some updates explaining what to do for newer three.js versions. For example:

// 2. The intensity values of point lights are changed. You need to pass way higher values now:
const pointLight = new THREE.PointLight(0xFFFFFF, 30000, 300);

That distance parameter is not really doing much, it’s a cutoff distance that stops the light from going farther. But if the light isn’t bright enough to reach that far, raising the cutoff distance won’t make it any brighter.

1 Like

That solves it. Thanks