This project implements a 3D rendering engine from scratch using Java. The engine can load 3D object files (e.g., .obj files created using tools like Blender) along with optional texture image files to render them on the screen. The program allows you to navigate and interact with the 3D environment, providing the ability to view objects from any angle and distance.
The objects are rendered using triangles for full compatibility with Blender and other 3D modeling software. The project also features rudimentary texture mipmapping, culling, and clipping for improved performance and realism.
- Full projection matrix: Includes Field of View (FOV), perspective projection, near and far planes, etc.
- Directional lighting to simulate light sources in the 3D world.
- Textures: Support for object textures (optional but enhances appearance).
- Texture mipmapping: Improves performance by using lower-resolution textures at distant objects.
- Culling and clipping: Removes objects outside the view frustum to optimize rendering.
- Import
.objfiles: Supports importing 3D objects created with tools like Blender (objects must be composed of triangles). - Movement and camera control: Navigate and look around in the 3D environment.
The initial prototype of this project began on Desmos, where I experimented with projecting 3D points onto a 2D screen. The graphing calculator provided an easy environment to play around with 3D concepts. You can view my Desmos prototype here.
- Java: The main programming language for the rendering engine.
- .obj files: For importing 3D object data.
- Textures: Optional image files for decorating 3D objects.
To run the project, follow these steps:
-
Clone the repository:
git clone https://github.com/YourUsername/3d-rendering-engine.git cd 3d-rendering-engine -
Build and run the project:
javac Main.java java Main
-
Interact with the 3D scene in the program:
- Use mouse and keyboard controls to move around the 3D space and view objects from different angles.
/: Contains the Java source code for the engine./objects/: Folder for 3D models (.objfiles)/textures/: Folder for textures (image files).README.md: Project description and instructions.Main.java: Entry point of the program for running the engine.
This project is licensed under the MIT License - see the LICENSE file for details.