$ show hyqzz/Solar-Wanderer
Solar Wanderer is a browser-based 1:1 real-time solar system explorer powered by NASA JPL ephemerides. Built with Three.js 0.165 and Vite 5, it renders the entire solar system at true scale (0.5m to 1e15 km) using a floating-origin world engine, logarithmic depth buffer, and Keplerian orbital mechanics. Users can seamlessly fly through space, walk on planetary surfaces (including real DEM terrain for Earth, Moon, Mars), dive into Earth's oceans, or orbit from a Google Earth-style camera. The application includes a bilingual (Chinese/English) interface with 7-language i18n, search, guided tours, educational facts with NASA sources, mobile touch controls, and shareable URLs. All ephemeris dataβplanets, 21 moons, 28 TNOs, 4 comets, and ~5400 small bodiesβis generated offline via scripts that fetch from NASA JPL and fitted to Horizons state vectors. The architecture is a client-only SPA with modular ES modules; no backend, no registration, no cookies. The codebase demonstrates high craftsmanship in its floating-origin precision, pure-function ephemeris, procedural terrain generation, and real-time atmosphere scattering, though it carries technical debt from a monolithic main.js and incomplete i18n for half its languages.
The LLM identified 4 files worth highlighting for reuse:
Implements a floating-origin world manager that maintains absolute double-precision positions for each celestial object and recomputes local Float32 positions relative to the camera each frame. This pattern enables seamless rendering from 0.5m to 1e15 km without precision loss. It is fully self-contained, registers objects via a simple API, and could be extracted to any large-scale 3D application requiring high-precision positioning.
Pure-function Kepler equation solver using Newton-Raphson iteration with eccentric anomaly correction and coordinate frame transforms. Returns (x,y,z) in the ecliptic frame given orbital elements and Julian Date. No internal importsβonly math. Demonstrates robust handling of near-parabolic orbits (e>0.99) and hyperbolic cases. Could be reused as a standalone library for any orbital mechanics simulation.
A single GLSL-based ray-marched atmosphere shader implementing a simplified Nishita scattering model. It works inside and outside the atmosphere, supports planet-specific parameters (Rayleigh/Mie coefficients, ozone layer, suspended dust), and integrates seamlessly with the planet material system. The JavaScript module sets up uniforms and provides a factory function for creating atmosphere meshes. Demonstrates advanced rendering technique in a reusable way.
A lightweight, dependency-free i18n system supporting seven languages with a cascading fallback (explicit language β en β zh β fallback key). It provides t() and bodyName() translation functions, applyDomI18n() for DOM updates, and integrates with the locale detection. The dictionary is embedded as a large object of ~200 keys. This pattern could be extracted for any multilingual web application.