An interactive 3D model of our solar system built with Three.js. Explore the planets, view detailed information, and visualize gravitational fields in this immersive web experience.
- Realistic 3D Models: Accurately scaled planets with high-resolution textures
- Interactive Controls:
- Orbit around the solar system with mouse controls
- Double-click to reset view
- Click planets to focus and view details
- Planet Information: Detailed facts about each planet including:
- Size, mass, and composition
- Orbital characteristics
- Surface conditions
- Fun facts
- Visual Effects:
- Atmospheric shaders for Earth and gas giants
- Animated gravity field visualization
- Dynamic starfield background
- Responsive Design: Adapts to different screen sizes
- Three.js - 3D JavaScript library
- WebGL - For hardware-accelerated graphics
- JavaScript ES6+ - For application logic
- HTML/CSS - For UI and styling
- Clone the repository:
git clone https://github.com/your-username/solar-system-threejs.git
- Navigate to the project directory:
cd solar-system-threejs - Install dependencies (if any):
npm install
- Run a local server (you can use Python's built-in server):
python -m http.server 8000
- Open your browser and navigate to:
http://localhost:8000
-
Navigation:
- Left-click and drag to rotate view
- Right-click and drag to pan
- Scroll to zoom in/out
- Double-click to reset view
-
Planet Interaction:
- Click on any planet to focus and view information
- Click again or use the "Close" button to return to solar system view
- Use the navigation buttons at the bottom to quickly jump to specific planets
-
Gravity Fields:
- Toggle the "Show Gravity Fields" button to visualize planetary gravitational influences
- Fields animate dynamically to show gravitational effects
solar-system/
├── assets/ # Planet textures and images
│ ├── earth.jpg
│ ├── jupiter.jpg
│ └── ...
├── js/
│ └── main.js # Main Three.js application code
├── index.html # Main HTML file
├── README.md # This file
└── styles.css # CSS stylesTo modify the solar system:
-
Add/Modify Planets:
- Edit the
planetsarray inmain.js - Add new texture images to the
assetsfolder - Use the
createPlanet()function to add new celestial bodies
- Edit the
-
Adjust Visuals:
- Modify lighting parameters in the scene setup
- Adjust atmosphere shaders in the planet creation function
- Change the starfield density by editing the
starVerticesarray
-
Add Information:
- Expand the
infoobject for each planet to include additional facts - Modify the
showPlanetInfo()function to display new data fields
- Expand the
- For best performance, use a modern browser with WebGL 2.0 support
- On mobile devices, consider reducing the star count or disabling shadows
- The gravity field visualization can be performance intensive - toggle it off if needed
- NASA for planetary texture images
- Three.js community for examples and documentation
- Space enthusiasts everywhere for inspiration
