'Real time globe with three.js

I am creating a globe within my react project and I need to correctly initialise this globe based on a given time, (ie, now or sometime in the future). This globe should position itself correctly against a light source's day and night cycle (the sun).

Are there any examples or libraries that can help with this task? I know satellite tracking applications have this problem solved, however, there isn't many correct examples.



Solution 1:[1]

There are a couple examples on the internet:

GitHub: On the home page of GitHub, you can see a globe that rotates and shows recent public commits.

Postprocessing: This example on the docs might help you out with the lighting of the sun.

As for the positioning of the globe based on time, you could grab the users current time:

var d = new Date();
hour = d.getHours(); //9 hours
minute = d.getMinutes(); //30 minutes

Then with that information, you can adjust your globe and light source (the sun) accordingly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anye