Thanks ChatGPT for that one!!
How to find the current sun angle from Earth's rotation in javascript?
A hint: Where is the sun shining on the earth at the time I visit the site? I guess the time zone that's closest to noon.
the dayTime variable needs to be from 0 to 1
const d = degToRad(360 / dayTime)
const sunPos = new Vec3(
Math.cos(d),
Math.sin(d) * Math.sin(0),
Math.sin(d) * Math.cos(0)
)
11 KiB
11 KiB