Skip to content

Latest commit

 

History

History
208 lines (167 loc) · 7.43 KB

File metadata and controls

208 lines (167 loc) · 7.43 KB

🌍 3D Orbit System

A realistic solar system simulation with Earth, Moon, and Sun orbiting in 3D space !

🎮 Overview

An interactive 3D visualization of a solar system where you can freely navigate and observe celestial bodies in motion with realistic lighting and dynamic effects.

> Scene Description:

A cosmic environment featuring the Sun at the center, Earth orbiting around it while rotating on its axis, and the Moon circling Earth. The background contains 1000 twinkling stars creating a stellar atmosphere, with 30 falling stars streaking across space. Dynamic dual-lighting system from both the Sun and Moon illuminates the scene realistically.

> Navigation:

  1. Move freely in 3D space with WASD and arrow keys
  2. Rotate camera with LEFT/RIGHT arrows
  3. Zoom in/out to observe planets in detail
  4. Control time to speed up or slow down orbital motion
  5. Watch realistic planetary rotations and orbital mechanics

> Key Controls:

WASD          : Move Forward/Backward/Left/Right
UP/DOWN       : Move Up/Down
LEFT/RIGHT    : Look Left/Right
Z / X         : Zoom In/Out
+ / -         : Speed Up/Slow Down Time (0.1x to 5x)
R             : Reset Time to Normal Speed
ESC           : Exit

🛠️ Implemented Technical Features

  • Free camera movement with full 3D navigation
  • Hierarchical transformations for orbital mechanics (Earth around Sun, Moon around Earth)
  • Phong lighting model with ambient, diffuse, and specular
  • Dual light sources (Sun as primary, Moon as secondary)
  • Dynamic textures on all celestial bodies
  • Particle systems for background and falling stars
  • Time control for animation speed

> Technologies Used:

  • C++17 with procedural programming
  • OpenGL 3.3+ (Core Profile) for 3D rendering
  • GLFW for window management and inputs
  • GLAD as OpenGL loader
  • GLM for 3D mathematics
  • STB Image for texture loading
  • CMake for build system
  • MinGW-w64 as Windows compiler

> Shader Structure:

  • Vertex Shader: MVP transformations + normal calculations + texture coords
  • Fragment Shader: Phong lighting + multi-texture support + dual light sources + star effects

> 3D Models:

  • Procedural spheres for Sun, Earth, Moon (parametric generation)
  • OBJ loader for falling stars (comet.obj)
  • Efficient mesh system with VAO/VBO/EBO

> Used Textures:

  • earth.jpg - Earth surface map
  • sun.jpg - Solar surface texture
  • moon.jpg - Lunar surface detail
  • Loaded via STB Image with automatic mipmap generation

🎬 ANIMATION:

1. Celestial Bodies

  • Sun: Slow axial rotation
  • Earth: Rotation on axis + orbit around Sun
  • Moon: Rotation on axis + orbit around Earth
  • Frame-independent timing for smooth animation

2. Falling Stars

  • 30 falling stars with left-to-right comet trajectory
  • High speed (15-30 units) without rotation
  • Red-blue color palette (red/blue/purple variants)
  • Respawn system when exiting boundaries

3. Background Stars

  • 1000 stars in spherical distribution
  • Twinkling effect with brightness variation
  • Point sprite rendering for circular shapes

💡 LIGHTING (Phong Model):

1. Ambient Light

  • Global illumination at base intensity (0.2)
  • Uniform distribution across all objects

2. Diffuse Light

  • Sun light source: White light (1.0, 1.0, 1.0) from origin
  • Moon light source: Weak blue-ish light (0.03) from Moon position
  • Normal-based calculation: max(dot(normal, lightDir), 0.0)

3. Specular Light

  • Reflections on surfaces with Phong model
  • Material shininess:
    • Earth: 32.0 (moderate)
    • Sun: 16.0 (self-illuminated, 10x brightness boost)
    • Moon: 8.0 (rough surface)
  • View direction calculation for accurate highlights

4. Dual Light System

  • Primary source: Sun at origin with full white light
  • Secondary source: Moon with weak reflected light
  • Combined contribution in fragment shader
  • Dynamic moon position following orbital calculations

📊 Important Technical Points

> Performance:

  • Optimized VAO/VBO usage with minimal state changes
  • Index buffers (EBO) for sphere geometry
  • Depth testing enabled for proper rendering
  • Efficient draw calls for all objects

> Extensibility:

  • Modular CelestialBody struct for easy planet addition
  • Configurable orbital parameters (radius, speed, size)
  • Shader-based rendering for easy effect additions

> Current Limitations:

  • Simplified physics (no real gravitational simulation)
  • Fixed orbital planes (no inclination)
  • Limited to 3 celestial bodies
  • No collision detection

🔮 Possible Future Improvements

  1. Additional planets (Mars, Jupiter, Saturn with rings)
  2. Realistic gravitational physics (N-body simulation)
  3. Planetary atmospheres with volumetric effects
  4. Shadow mapping between celestial bodies
  5. Orbit trail visualization
  6. Information overlay with real-time data
  7. Screenshot capture functionality

🚀 How to Run the Project

> Requirements:

  • Windows 10/11 (tested on MinGW-w64)
  • CMake 3.15+
  • OpenGL 3.3+ compatible GPU

> Quick Start:

# 1. Clone/Download the project
git clone [https://github.com/Hanaa-22/3D-Orbit-System]

# 2. Navigate to project
cd tp

# 3. Compile and Launch
build_run.bat

# 4. Simulation window opens HEY HEY HEY !!

📁 Project Structure and Libraries

3D-OrbitSystem/
├── .gitignore
├── README.md                    
├── tp/ 
│   ├── (build folder)                 
│   ├── main.cpp                 # Main entry point
│   ├── objload.cpp/.hpp         # OBJ model loader
│   ├── CMakeLists.txt           # Build configuration
│   └── build_run.bat            # Automatic build script
│
└── libs/                        
    ├── glad/                    # OpenGL Loader
    ├── GLFW/                    # Window management
    ├── glm-1.0.2/               # 3D mathematics
    ├── mingw64/                 # MinGW compiler
    ├── shader/                  
    │   ├── shader.cpp/.hpp      # Shader manager
    │   └── Shader.vertexshader/.fragmentshader
    ├── model/                   
    │   └── comet.obj       # Falling star 3D model
    ├── stb/                     
    │   └── stb_image.h          # Image loader
    └── textures/                
        ├── earth.jpg
        ├── sun.jpg
        └── moon.jpg

🎓 Project Context

This project was developed within the educational TP Project for the Image Synthesis course in C++/OpenGL.

Project Requirements (Fulfilled):

Animation - Planetary rotations, orbits, falling stars
User Interaction - Camera control, time manipulation, zoom
Lighting - Phong model with dual light sources (Sun + Moon)
Additional Features - Textures, particle systems, OBJ loading

✨ Developed By

By: "[B.Hanaa]" - Final year student in Visual Computing master; passionate about graphics programming.

License: This project is open-source under MIT license. Feel free to use it as a base for your own educational projects!


Last Updated: [22-01-2026] Version: 1.0.0
Status: Complete and functional