This project is a 3d model render which is based on the series of articles "Tiny renderer or how OpenGL works" by Dmitry V. Sokolov located here. Russian version of this articles is at Habr.
C++ version is here.
- Java 8
- Maven 3.x
- Java 8
git clone https://github.com/dimaopen/tinyrenderer-java.git
cd tinyrenderer-java
mvn clean package
java -jar tinyrenderer-1.0.0-SNAPSHOT.jar path/to/your/model.obj
As a single argument it takes a path to Wavefront .obj file. The model texture should be at the same directory named your_model_name_diffuse.tga. You can download some models from https://github.com/ssloy/tinyrenderer/tree/master/obj
To render a sample model just execute
mvn exec:java
The result picture is located at working_dir/result.png
It's not ideal from performance perspective. I tried to code in an explicit way. Using Scanner instead of BufferedReader and StringTokenizer in model file parsing causes some performance penalty. Also the immutable Vectors require constant creating new Vectors instead of just changing primitive components.