KevenLi8888 / procedural_planetary_system

CS2230 Computer Graphics Final Project (OpenGL)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Procedurally Generated Planetary Systems [Demo Video]

1. Orbits and movements

A planet orbits around another with respect to an orbital axis and radius. Planets are stored in a tree such that updating each planet’s CTM is equivalent to performing a pre-order traversal. This hierarchical structure enables nested rotational relationships (moons orbiting around planets, systems orbiting around systems, etc.)

2. Planetary system generation

The user could generate a procedural planetary system that is similar to our solar system with some control over the parameters. These planets use procedurally generated textures for further variations.

3. Camera

There are two camera modes:

  • Default Camera: Use W, A, S, D to move and the mouse to look around.
  • Orbit Camera: Use W, S to zoom in and out; use A, D to switch between planets; use the mouse to rotate about the planet.

4. Texture Generation

The planet colors are random variations on some pre-defined color palettes. We divide planets into two types - one with “terrain” and the other with “rings”.

For terrain-like texture generation, we implemented Perlin noise, and used the noise values to get the colors. For planets with rings, we used a simple Beizer Curve.

5. Normal Mapping

Normals are sampled from image textures, which stores values in tangent space. To make lighting works correctly, we transform the lighting variables from world space to tangent space, and calculate lighting with tangent-space normals. This transformation is done in the vertex shader, since lighting variables remain the same across all fragments.

About

CS2230 Computer Graphics Final Project (OpenGL)


Languages

Language:C++ 43.3%Language:C 33.7%Language:HTML 18.0%Language:XSLT 1.5%Language:Python 1.2%Language:Perl 0.5%Language:Shell 0.4%Language:PHP 0.3%Language:Tcl 0.3%Language:CMake 0.3%Language:GLSL 0.2%Language:CSS 0.2%Language:Hack 0.1%Language:Raku 0.1%Language:JavaScript 0.0%