A collection of triangle mesh subdivision/tessellation/decimation implementations.
git clone https://github.com/chaosink/subface.git --recursive
cd subface
mkdir build
cd build
cmake ..
cmake --build . --config Debug # Or Release
- Command line
Usage: subface [-h] [--cmd] [--export_obj] [--save_png] [--smooth] [--fix_camera] [--cull] [--transparent] [--render VAR] [--method VAR] [--level VAR] OBJ_file_path
Process geometries with one of the following methods:
1.LoopSubdivideSmooth
2.LoopSubdivideSmoothNoLimit
3.LoopSubdivideFlat
4.Tessellate4
5.Tessellate4_1
6.Tessellate3
7.Decimate_ShortestEdge_V0
8.Decimate_ShortestEdge_Midpoint
9.MeshoptDecimate
10.MeshoptDecimateSloppy
11.SimplygonDecimate
Positional arguments:
OBJ_file_path OBJ file path
Optional arguments:
-h, --help shows help message and exits
-v, --version prints version information and exits
-c, --cmd run in command line mode
-e, --export_obj export OBJ in command line mode
-s, --save_png save PNG in command line mode
-n, --smooth use smooth normal
-f, --fix_camera fix camera
-u, --cull enable face culling
-t, --transparent enable transparent window
-r, --render render mode ID [default: 0]
-m, --method processing method ID [default: 1]
-l, --level processing level [default: 0]
- Rendering
| key | function |
|---|---|
Tab |
switch rendering mode: FacesWireframe (default), FacesOnly, WireframeOnly |
N |
enable / disable (default) smooth rendering |
C |
enable / disable (default) face culling |
T |
enable / disable (default) transparent window |
F |
use camera's fixed parameters |
R |
refresh camera's fixed parameters |
P |
print camera's current parameters |
F2 |
save the screenshot as a PNG file |
ESC |
exit |
- Camera controlling
| key | function |
|---|---|
(Shift +) W/S/A/D/Q/E |
(slowly) move forward / backward / left / right / down / up |
(Shift +) J/L/I/K |
(slowly) turn left / right / up / down |
-/= |
slow down / speed up movement |
[/] |
slow down / speed up turning |
Space |
reset camera and model |
mouse left button |
rotate model |
mouse right button |
change camera direction |
mouse scroll wheel |
adjust field of view |
- Triangle mesh processing
| key | function |
|---|---|
Ctrl + 1,...,6 |
choose from the subdivision and tessellation methods 1.LoopSubdivideSmooth 2.LoopSubdivideSmoothNoLimit 3.LoopSubdivideFlat 4.Tessellate4 5.Tessellate4_1 6.Tessellate3 |
Alt + 1,...,5 |
choose from the decimation methods 1.Decimate_ShortestEdge_V0 2.Decimate_ShortestEdge_Midpoint 3.MeshoptDecimate 4.MeshoptDecimateSloppy 5.SimplygonDecimate |
0-9 |
processing level, 0 for the original mesh (default) |
,/. |
decimate one less/more triangle for the decimation methods |
O |
export the processed mesh as an OBJ file |
- Rendering modes
| FacesWireframe | FacesOnly |
|---|---|
|
|
| WireframeOnly, Cull_false | WireframeOnly, Cull_true |
|
|
- LoopSubdivideSmooth, Normal_flat vs Normal_smooth
- Processing methods: subdivision and tessellation methods, level=2
| LoopSubdivideSmooth | LoopSubdivideSmoothNoLimit |
|---|---|
|
|
| LoopSubdivideFlat | Tessellate4 |
|
|
| Tessellate4_1 | Tessellate3 |
|
|
- Processing methods: decimation methods, level=5 (decimation ratio=50%)
| original mesh | SimplygonDecimate |
|---|---|
|
|
| Decimate_ShortestEdge_V0 | Decimate_ShortestEdge_Midpoint |
|
|
| MeshoptDecimate | MeshoptDecimateSloppy |
|
|
/suzanne.origin.Normal_flat.FacesWireframe.Cull_true.png)



/suzanne.origin.Normal_smooth.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=1).Normal_flat.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=1).Normal_smooth.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=2).Normal_flat.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=2).Normal_smooth.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=3).Normal_flat.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=3).Normal_smooth.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=4).Normal_flat.FacesWireframe.Cull_true.png)
/suzanne.LoopSubdivideSmooth(level=4).Normal_smooth.FacesWireframe.Cull_true.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)
.Normal_flat.FacesWireframe.Cull_false.png)