Space Generator
Mathias Plans, Karl Marti Toots, Jon Ander Sukia Herrador
DEMO CLIP
Repository
We are using GitHub for our project and it's available at this link: https://github.com/karlmartitoots/CGProject Live link to our project (master branch): http://karlmartitoots.github.io/CGProject
Initial project description
Multiplanetary star system simulation with procedurally generated planets including companions, space dust, stars. Procedurally generated landscape, terrestrial and sea with varying altitude/profile, general structures like biomes, mountains, forests, rivers, etc. Adding shadows, random appearance shaders. This is open for some discussion.
Features
The system consists of a scene tree. The center of the star system is the root. The planets use translation to change the position. The children of the planets are the moons. The star is the light source. Also, have a command/short-key for teleporting to the nearest body. The camera can follow planets/other bodies. Planets have adjustable sizes.
Controls
You can find the controls in the following table :
Keys | Action |
---|---|
Mouse movement & Directional arrows | Moves where our camera looks at |
W & left click | Move camera forward |
S & right click | Move camera backwards |
A | Move camera Left |
D | Move camera Right |
Q | Tilt camera Left |
E | Tilt camera Right |
R | Move camera Up |
F | Move camera Down |
Esc | Changes control mode from mouse + wasdqe to arrow keys |
U | Body explorer: go to "father" (example: from a moon to its planet) |
I | Body explorer: next |
O | Body explorer: go to "children" (example: from a planet to its moon) |
Mouse wheel | Zoom in and out in the body explorer mode |
Left click and move (in body explorer) | Move the camera arownd the body |
Right click and move (in body explorer) | Move the camera in the plane you are in |
Problems
We have problems with the lighting: Three.js does not support area-light with shadows. Also, if we have a moon, it will also cast shadows (although weak ones). The solution would be to use multiple point lights, but this could be very resource-heavy, so we are currently researching how to solve this issue.
We managed to solve the lighting issue by creating our own shader that creates soft shadows granted that the light source and the bodies we want to take into account are spheres. The following Gif shows the final result we achieved! It shows the shadows projected by the moons of the planet.
Progress Screenshot
In this image, we can see our initial work, featuring two little stars that generate light and two celestial bodies with their own orbit.
In the previous two images, we can see that we randomly generate star systems with a central star representing the sun ( the light source ) and planets with companions.
This image shows us the top view that we get to by pressing 't'. We also change the orbits to be ellipses.
Here we can see that we added textures to the celestial bodies by using procedural generation similar to our laboratory task but using simplex noise .
We created a skybox and procedurally generate stars on it to give more of a realistic look to the project.
As you can see in the previous images, we created better-looking planets, lava planets, and moons. On the other hand, you can check out how our body explorer feature looks like in the following Gif where we follow a lava planet.
The next Gif shows the body explorer feature more in-depth. We start on a planet by pressing "I", and we can go into its moons by pressing "I" again. When we are on a moon, we can go to the next moon by pressing "O" or go back to the planet by pressing "U". Then we go to the next planet by pressing "O", as explained in the controls part.
We also worked on biomes such as a desert biome, which is more common on planets near the Sun, and uncommon or none existent at all in planets very far away from the Sun. We also added winter to our planets, and you can check both the winter and the desert biomes in the following GIFs.