Giter Site home page Giter Site logo

kevenli8888 / procedural_planetary_system Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19.02 MB

CS2230 Computer Graphics Final Project (OpenGL)

CMake 0.27% C 33.73% Python 1.18% PHP 0.32% Tcl 0.27% Hack 0.12% XSLT 1.50% JavaScript 0.03% HTML 18.05% CSS 0.18% Shell 0.35% Perl 0.48% Raku 0.06% C++ 43.27% GLSL 0.18%

procedural_planetary_system's Introduction

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.

procedural_planetary_system's People

Contributors

github-classroom[bot] avatar kevenli8888 avatar tyk10 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.