A Python-based 3D rendering engine using Pygame library, featuring a Rubik's Cube model display and trivial fluid simulation effects. This project was inspired by and builds upon concepts learned from YouTube tutorial on 3D Engine and Technology of Raycasting.
โข ๐ผ๏ธ 3D Object Rendering: Loads and displays 3D models from OBJ files
โข ๐ฅ Interactive Camera: Full 360ยฐ navigation with keyboard controls
โข ๐งฎ Matrix Transformations: Support for translation, rotation, and scaling
โข ๐ Water Simulation: basic fluid surface with wave animations
โข Projection Pipeline: Implements a complete 3D rendering pipeline with perspective projection matrices
โข Homogeneous Coordinates: Uses 4D homogeneous coordinates for all transforms (translation, rotation, scaling)
โข Camera System: First-person camera with view matrix composition from position and orientation vectors
โข Object Loading: Custom OBJ file parser that extracts vertex and face data
โข Wave Algorithm: Procedural water waves using layered sine functions with time-based animation
โข W/A/S/D: Move camera forward/left/backward/right
โข Q/E: Move camera up/down
โข Arrow Keys: Rotate camera view
- ๐ฅ Clone the repository:
git clone https://github.com/yourusername/3d-engine-py.git cd 3d-engine-py - ๐ Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv/Scripts/activate`
- ๐ฆ Install dependencies:
pip install -r requirements.txt # On Windows if pip is not recognized, try: `py -m pip install -r requirements.txt` - ๐น๏ธ Run the Engine:
python main.py
3d-engine-py/
โโโ main.py # Entry point and main rendering loop
โโโ camera.py # Camera implementation with movement controls
โโโ object_3d.py # 3D object representation and rendering
โโโ projection.py # Matrix projection utilities
โโโ matrix_functions.py # Mathematical transformation functions
โโโ water.py # Water surface simulation with wave effects
|
โโโ resources/ # Different 3d models and objects for display
|โโโ RubixCube.obj
|โโโ skull.obj
|
โโโ screenshots/
|โโโ visual_showcase.gif
|โโโ visual_showcase.jpg
|
โโโ requirements.txt
โโโ README.mdโ โ โ โ โ โ โ โ โ โ โ โ โ โ# This file
This project was inspired by tutorials on 3D graphics programming fundamentals available on YouTube, particularly Creating a 3D Engine with Python by Coder Space. The core concepts were learned from these educational resources and extended with additional features like the water simulation.
