Welcome to the Submarine Simulation System! This project is a real-time 3D submarine simulation developed for a college project. It provides users with an immersive experience navigating various submarine models in a realistic, interactive ocean environment. This system was built with scientific precision in mind, incorporating advanced physics, hydrodynamics, and fluid mechanics to ensure accuracy. ๐
-
Real-time Submarine Simulation: Navigate submarines with precise controls in a beautifully rendered 3D oceanic environment. โด๏ธ
-
Physics-Based Simulation: The simulation uses realistic physics, including wave interactions, buoyancy, and underwater dynamics, offering an authentic experience. ๐
-
Multiple Submarine Models: Choose between different submarine classes (Typhoon and Ohio), each with unique characteristics and customizable controls. ๐ค
-
Comprehensive Control Panel: Modify submarine controls like rudders, fairwater, engine speed, and ballast tanks. ๐ฆ
-
Interactive Environment: Experience both surface and underwater environments with accurate light refraction, shading, and sound dynamics based on the submarineโs position. ๐ฎ
-
Responsive Camera Views: Control the camera freely or lock it to follow the submarine, providing versatile perspectives. ๐ฅ
-
Sound Dynamics: Sound changes based on whether you're above or below the water surface. The engine sound adjusts based on speed and proximity. ๐
-
Modular Design: Built with extensibility in mind, allowing for easy customization and future feature additions. ๐ง
-
Vite Build Integration: Fast development workflow powered by Vite. โก
The physics behind this simulation are based on advanced fluid dynamics and mechanical principles derived from research and a master's thesis on hydrodynamics. Here's an overview of key technical aspects:
-
Submarine Control Physics:
- Rudder: Controls the yaw movement (left-right steering).
- Fairwater and Stern: Control pitch and depth (up-down motion).
- Propeller Dynamics: Speed is tied to engine RPM, affecting the submarine's forward movement.
-
Fluid Mechanics:
- Simulates real-world water resistance, buoyancy, and drag forces acting on the submarine.
- Water density and gravity are configurable parameters that impact the submarine's motion.
-
Collision Detection:
- A sophisticated collision system prevents the submarine from moving through the sea floor or other objects. The system calculates corrective forces, slowing the submarine before impact.
-
Realistic Ocean Rendering:
- The ocean surface and underwater environments simulate real-world lighting and refraction effects, including changing skyboxes for different times of day (dawn, noon, sunset).
The demo allows users to interact with two different submarine models and experience various controls:
- Models: Navigate both the Typhoon and Ohio class submarines.
- Controls:
- Adjust depth, speed, rudders, and engine power.
- Experience changes in submarine physics based on adjustments to ballast tanks and propeller speed.
- Environment Interaction:
- The simulation features day-night cycles, water reflection, and refraction effects.
- Switch between surface and underwater views.
- Real-time Physics Display: View detailed data on submarine dynamics in a side panel (speed, angle, depth).
For more detailed information, please refer to the project report attached in this repository.
- Frontend: Developed using Three.js for real-time 3D rendering. ๐ผ๏ธ
- Bundler: Vite provides fast and efficient build processes. โก
- Docker Integration: Supports Docker for easy containerized deployment. ๐ณ
- Node.js: Make sure Node.js is installed.
- Docker (Optional): Recommended for consistent environment setup.
-
Clone the Repository:
git clone https://github.com/your-username/submarine-simulation-system.git
-
Navigate to the Project Directory:
cd submarine-simulation-system
-
Install Dependencies:
npm install
-
Run Locally:
npm run dev
Open the application at http://localhost:8084/.
To create an optimized production build:
npm run build
Run the project using Docker for a containerized environment:
docker build -t your-custom-image-name .
docker run -p 8084:8084 your-custom-image-name
A documentation website has been created for this project, detailing the code structure and usage. Access it here.
The project is also deployed and accessible online at https://submarine-simulation-system.vercel.app/.
The full project report is available here. It includes detailed information about the physics, hydrodynamics, and technical design of the submarine simulation system.
The environment and ocean rendering in this project were adapted from the open-source Three.js Ocean Scene by Nugget8. Special thanks to the original author for providing this fantastic resource.
We welcome contributions! Hereโs how you can contribute:
- Fork the repository.
- Create a feature branch (
git checkout -b feature-name
). - Commit your changes (
git commit -m 'Add new feature'
). - Push to the branch (
git push origin feature-name
). - Open a pull request.
This project is licensed under the MIT License.