Build a stunning, fully interactive 3D Mars Perseverance Rover simulator that runs directly in a web browser. **Objective:** Create a scientifically informed, visually impressive NASA/JPL-style Mars exploration simulator using Three.js, WebGL, HTML, CSS, and JavaScript. Reference: https://en.wikipedia.org/wiki/Perseverance_(rover) ### Requirements 1. **Mars Environment** - Render a realistic 3D Martian landscape inspired by Jezero Crater. - Include rocky terrain, sand dunes, craters, mountains, and geological formations. - Use realistic Martian surface colors, atmospheric haze, sunlight, and shadows. - Generate detailed terrain procedurally without requiring external terrain assets. 2. **Perseverance Rover** - Build a recognizable, detailed 3D model of NASA's Perseverance rover. - Include its six wheels, rocker-bogie suspension, robotic arm, camera mast, antennas, and scientific instruments. - Animate wheel rotation, suspension movement, and steering realistically. - Approximate the rover's actual dimensions and mechanical configuration. 3. **Interactive Rover Driving** - Allow users to drive the rover using WASD or arrow keys. - Include forward, reverse, left, right, and stop controls. - Make the wheels respond realistically to uneven terrain. - Prevent the rover from passing through large rocks or unrealistic slopes. - Display rover speed, heading, distance traveled, and estimated wheel slippage. 4. **Camera System** - Provide multiple selectable camera views: - Third-person chase camera - Front navigation camera - Rover mast camera - Top-down orbital view - Free-roaming cinematic camera - Support mouse rotation, zoom, and panning. - Smoothly transition between camera modes. 5. **Autonomous Navigation** - Include an interactive "AutoNav" mode inspired by Perseverance's actual autonomous navigation capabilities. - Allow users to click a destination on the Martian surface. - Automatically calculate a path around rocks, obstacles, and hazardous terrain. - Display the planned route as a visible 3D overlay. - Show how the rover adjusts its route when encountering obstacles. - Clearly distinguish the simplified simulation from NASA's actual AutoNav implementation. 6. **Scientific Exploration** - Let users select and investigate geological targets. - Animate the robotic arm positioning itself toward selected rocks. - Simulate scientific observations using instruments such as SuperCam, PIXL, and SHERLOC. - Display educational information about possible mineral compositions and ancient Martian environments. - Label all generated scientific readings as simulated, not actual NASA measurements. 7. **Mission Control Dashboard** - Design a professional NASA/JPL-inspired mission control interface. - Display rover status, speed, coordinates, heading, power estimates, terrain slope, and mission elapsed time. - Include an interactive minimap showing the rover's current position and traveled route. - Provide buttons for camera modes, manual driving, AutoNav, scientific scanning, and resetting the simulation. - Include a live FPS counter. 8. **Mars Environmental Effects** - Implement a realistic Martian day/night lighting cycle. - Provide controls for sunrise, midday, sunset, and nighttime. - Add atmospheric dust and optional dust-storm effects. - Simulate realistic changes in visibility and lighting. 9. **Guided Mission Mode** - Include a guided exploration mission with several waypoints. - Let the rover autonomously travel between geological targets. - Animate scientific inspections at selected locations. - Display educational commentary explaining the mission and scientific objectives. 10. **Performance and Scientific Accuracy** - Optimize the simulation for smooth performance on modern desktop browsers, including Apple Silicon Macs. - Use efficient geometries, instancing, and level-of-detail techniques where appropriate. - Ensure all buttons and interactive controls actually work. - Make the interface responsive on desktop and mobile devices. - Use accurate NASA rover specifications whenever possible. - Clearly identify simplified physics, estimated values, and fictional terrain. ### Technical Requirements - Deliver the entire working application as ONE self-contained HTML file. - Use Three.js through a CDN, but do not require external 3D models, texture files, API keys, or backend services. - Generate the rover geometry, terrain, rocks, and textures programmatically. - Use real 3D geometry rather than a 2D illustration or prerecorded animation. - Include all CSS and JavaScript inside the HTML file. - The simulator must work immediately when opened in a modern browser with internet access to load Three.js. - Do not provide pseudocode or incomplete examples. - Implement every major feature rather than displaying nonfunctional placeholder buttons. - Test and correct the implementation as thoroughly as your execution environment allows. - If direct browser testing is unavailable, explicitly acknowledge that limitation. - Prioritize a working, visually impressive simulator over unnecessary complexity. ### Final Deliverable Produce a complete interactive 3D Mars Perseverance Rover simulator with a polished NASA/JPL mission control interface, realistic animated rover, procedurally generated Martian landscape, manual driving, autonomous navigation, multiple camera perspectives, and scientific exploration features. Output the complete HTML source code, ready to save as `mars_perseverance_simulator.html` and open in a web browser.