A program that converts 3D models (.obj) into voxelized representations composed of small uniform cubes, similar to Minecraft. The conversion is performed using an Octree data structure with a Divide and Conquer algorithm. Only the surface of the object is voxelized, and voxel collection is done concurrently using Java's ForkJoinPool for improved performance.
- Java Development Kit (JDK) 17 or higher
- No external libraries required
To check your Java version:
java -versionFrom the root directory of the repository, run:
javac -d bin src/*.javaThis will compile all source files and place the compiled .class files into the bin/ directory.
After compiling, run the program with:
java -cp bin MainThe program will prompt you interactively:
=================================================
Voxelization Objek 3D menggunakan Octree
=================================================
Masukkan path file .obj : test/input/pumpkin.obj
Masukkan max depth : 5
- Path file: Enter the path to the
.objfile, either relative or absolute (e.g.test/input/bunny.objorC:\models\bunny.obj). - Max depth: Enter a positive integer representing the maximum depth of the octree. Higher depth = more detailed voxelization but longer execution time.
The voxelized output .obj file will be saved to test/output/.
Additional .obj files for testing and experimentation are provided via an external Google Drive you can access here : https://drive.google.com/drive/u/0/folders/1KClZsiCBkkNUVR8IZ7QVc3_Md8761h96
After running, the program will display:
- Number of voxels, vertices, and faces generated
- Octree node statistics per depth (including root at depth 0)
- Pruned node statistics per depth
- Total execution time (parse + octree build + voxel collection)
- Output file path
Example output:
=================================================
HASIL VOXELISASI
=================================================
Jumlah voxel : 10896
Jumlah vertex : 87168
Jumlah face : 130752
Kedalaman max : 6
Statistik Node Octree (node terbentuk per depth)
0 : 1
1 : 8
2 : 64
3 : 160
4 : 704
5 : 2656
6 : 10896
Statistik Node yang Tidak Ditelusuri (pruned per depth)
2 : 44
3 : 72
4 : 372
5 : 1294
Kedalaman octree : 6
Waktu eksekusi : 309 ms
Path file output : test/output/cowres.obj
=================================================
After voxelization completes, the program will ask if you want to open the result in a 3D viewer:
Buka 3D viewer? [y/N]:
The viewer is built from scratch using javax.swing and java.awt with manual implementation of:
- Camera representation
- Perspective projection (3D → 2D)
- Screen space mapping
- Back-face culling
- Painter's algorithm
Controls:
- Left drag: Rotate model
- Scroll: Zoom in / out
Tucil2_13524017_13524081/
├── src/
│ ├── Parser.java # OBJ file parser and validator
│ ├── BoundingBox.java # AABB with SAT triangle intersection
│ ├── Octree.java # Octree build with Divide and Conquer
│ ├── Voxel.java # Voxel collection (concurrent ForkJoin)
│ ├── ObjWriter.java # Write voxelized OBJ output
│ ├── Output.java # Statistics and report
│ ├── Viewer.java # 3D viewer (bonus)
│ └── Main.java # Entry point
├── bin/ # Compiled .class files (not tracked)
├── test/
│ └── input/ # Sample OBJ files for testing
├── doc/ # Laporan PDF
└── README.md
| Name | NIM |
|---|---|
| Aziza Dharma Putri | 13524017 |
| Alya Nur Rahmah | 13524081 |
Program Studi Teknik Informatika
Sekolah Teknik Elektro dan Informatika
Institut Teknologi Bandung
2025/2026