A realistic solar system simulation with Earth, Moon, and Sun orbiting in 3D space !
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.
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.
- Move freely in 3D space with WASD and arrow keys
- Rotate camera with LEFT/RIGHT arrows
- Zoom in/out to observe planets in detail
- Control time to speed up or slow down orbital motion
- Watch realistic planetary rotations and orbital mechanics
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
- 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
- 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
- Vertex Shader: MVP transformations + normal calculations + texture coords
- Fragment Shader: Phong lighting + multi-texture support + dual light sources + star effects
- Procedural spheres for Sun, Earth, Moon (parametric generation)
- OBJ loader for falling stars (
comet.obj) - Efficient mesh system with VAO/VBO/EBO
- earth.jpg - Earth surface map
- sun.jpg - Solar surface texture
- moon.jpg - Lunar surface detail
- Loaded via STB Image with automatic mipmap generation
- Sun: Slow axial rotation
- Earth: Rotation on axis + orbit around Sun
- Moon: Rotation on axis + orbit around Earth
- Frame-independent timing for smooth animation
- 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
- 1000 stars in spherical distribution
- Twinkling effect with brightness variation
- Point sprite rendering for circular shapes
- Global illumination at base intensity (0.2)
- Uniform distribution across all objects
- 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)
- 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
- 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
- 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
- Modular CelestialBody struct for easy planet addition
- Configurable orbital parameters (radius, speed, size)
- Shader-based rendering for easy effect additions
- Simplified physics (no real gravitational simulation)
- Fixed orbital planes (no inclination)
- Limited to 3 celestial bodies
- No collision detection
- Additional planets (Mars, Jupiter, Saturn with rings)
- Realistic gravitational physics (N-body simulation)
- Planetary atmospheres with volumetric effects
- Shadow mapping between celestial bodies
- Orbit trail visualization
- Information overlay with real-time data
- Screenshot capture functionality
- Windows 10/11 (tested on MinGW-w64)
- CMake 3.15+
- OpenGL 3.3+ compatible GPU
# 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 !!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
This project was developed within the educational TP Project for the Image Synthesis course in C++/OpenGL.
โ
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
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