Spaces:
Runtime error
Runtime error
vgvm
commited on
Commit
·
fbcab86
1
Parent(s):
1f9c659
fix quads and add workflow comment
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ import pygltflib
|
|
14 |
import struct
|
15 |
import tempfile
|
16 |
|
17 |
-
# ok... I goofed one of them :-(
|
18 |
QUADS = [
|
19 |
[300, 334, 333, 298] , [ 1, 12, 303, 268] , [234, 233, 122, 129] , [270, 304, 305, 271] , [246, 129, 115, 189] ,
|
20 |
[112, 118, 229, 32] , [104, 55, 69, 105] , [228, 35, 128, 235] , [120, 102, 101, 121] , [ 74, 73, 38, 40] ,
|
@@ -35,7 +34,6 @@ QUADS = [
|
|
35 |
[ 12, 73, 39, 13] , [208, 217, 207, 206] , [238, 221, 116, 219] , [ 46, 221, 238, 45] , [184, 43, 75, 185] ,
|
36 |
[209, 202, 195, 33] , [269, 272, 304, 303] , [214, 148, 178, 216] , [235, 94, 138, 228] , [ 67, 108, 109, 70] ,
|
37 |
[ 7, 352, 418, 169] , [193, 188, 148, 214] , [ 97, 63, 77, 78] , [125, 47, 71, 157] , [317, 16, 17, 316] ,
|
38 |
-
[115, 129, 122, 48] , [148, 124, 138, 178] , [252, 285, 333, 334, 299, 302] , [181, 86, 87, 180] , [290, 393, 291, 306] ,
|
39 |
[180, 87, 88, 179] , [106, 64, 54, 53] , [119, 118, 124, 51] , [146, 145, 25, 24] , [325, 319, 320, 326] ,
|
40 |
[123, 189, 175, 197] , [293, 309, 325, 326] , [150, 171, 170, 151] , [178, 138, 94, 133] , [328, 295, 456, 461] ,
|
41 |
[361, 421, 457, 364] , [336, 274, 376, 322] , [396, 395, 431, 432] , [ 13, 39, 83, 14] , [278, 330, 350, 351] ,
|
@@ -100,7 +98,9 @@ QUADS = [
|
|
100 |
[249, 196, 6, 282] , [216, 178, 133, 59] , [286, 296, 297, 337] , [382, 383, 342, 257] , [287, 259, 443, 442] ,
|
101 |
[211, 170, 171, 212] , [306, 461, 456, 290] , [104, 105, 70, 68] , [271, 305, 409, 410] , [460, 310, 439, 458] ,
|
102 |
[214, 216, 139, 193] , [317, 316, 405, 404] , [181, 91, 92, 182] , [ 1, 165, 168, 38] , [363, 464, 342, 383] ,
|
103 |
-
[210, 130, 103, 50] , [305, 273, 408, 409] , [311, 416, 408, 273] , [309, 293, 408, 416] , [184, 63, 79, 192]
|
|
|
|
|
104 |
]
|
105 |
|
106 |
class face_image_to_face_mesh:
|
@@ -110,9 +110,22 @@ class face_image_to_face_mesh:
|
|
110 |
gr.Markdown(
|
111 |
"""
|
112 |
# Face Image to Face Quad Mesh
|
113 |
-
Uses MediaPipe to detect a face in an image and convert it to a
|
114 |
Currently saves to OBJ, hopefully glb at some point with color data.
|
115 |
The 3d viewer has Y pointing the opposite direction from Blender, so ya hafta spin it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
""")
|
117 |
|
118 |
with gr.Row():
|
|
|
14 |
import struct
|
15 |
import tempfile
|
16 |
|
|
|
17 |
QUADS = [
|
18 |
[300, 334, 333, 298] , [ 1, 12, 303, 268] , [234, 233, 122, 129] , [270, 304, 305, 271] , [246, 129, 115, 189] ,
|
19 |
[112, 118, 229, 32] , [104, 55, 69, 105] , [228, 35, 128, 235] , [120, 102, 101, 121] , [ 74, 73, 38, 40] ,
|
|
|
34 |
[ 12, 73, 39, 13] , [208, 217, 207, 206] , [238, 221, 116, 219] , [ 46, 221, 238, 45] , [184, 43, 75, 185] ,
|
35 |
[209, 202, 195, 33] , [269, 272, 304, 303] , [214, 148, 178, 216] , [235, 94, 138, 228] , [ 67, 108, 109, 70] ,
|
36 |
[ 7, 352, 418, 169] , [193, 188, 148, 214] , [ 97, 63, 77, 78] , [125, 47, 71, 157] , [317, 16, 17, 316] ,
|
|
|
37 |
[180, 87, 88, 179] , [106, 64, 54, 53] , [119, 118, 124, 51] , [146, 145, 25, 24] , [325, 319, 320, 326] ,
|
38 |
[123, 189, 175, 197] , [293, 309, 325, 326] , [150, 171, 170, 151] , [178, 138, 94, 133] , [328, 295, 456, 461] ,
|
39 |
[361, 421, 457, 364] , [336, 274, 376, 322] , [396, 395, 431, 432] , [ 13, 39, 83, 14] , [278, 330, 350, 351] ,
|
|
|
98 |
[249, 196, 6, 282] , [216, 178, 133, 59] , [286, 296, 297, 337] , [382, 383, 342, 257] , [287, 259, 443, 442] ,
|
99 |
[211, 170, 171, 212] , [306, 461, 456, 290] , [104, 105, 70, 68] , [271, 305, 409, 410] , [460, 310, 439, 458] ,
|
100 |
[214, 216, 139, 193] , [317, 316, 405, 404] , [181, 91, 92, 182] , [ 1, 165, 168, 38] , [363, 464, 342, 383] ,
|
101 |
+
[210, 130, 103, 50] , [305, 273, 408, 409] , [311, 416, 408, 273] , [309, 293, 408, 416] , [184, 63, 79, 192] ,
|
102 |
+
[115, 129, 122, 48] , [148, 124, 138, 178] , [181, 86, 87, 180] , [290, 393, 291, 306] , [252, 285, 299, 302] ,
|
103 |
+
[285, 333, 334, 299]
|
104 |
]
|
105 |
|
106 |
class face_image_to_face_mesh:
|
|
|
110 |
gr.Markdown(
|
111 |
"""
|
112 |
# Face Image to Face Quad Mesh
|
113 |
+
Uses MediaPipe to detect a face in an image and convert it to a quad mesh.
|
114 |
Currently saves to OBJ, hopefully glb at some point with color data.
|
115 |
The 3d viewer has Y pointing the opposite direction from Blender, so ya hafta spin it.
|
116 |
+
|
117 |
+
The initial workflow I was imagining was:
|
118 |
+
|
119 |
+
1. sculpt high poly mesh in blender
|
120 |
+
2. snapshot the face
|
121 |
+
3. generate the mesh using the mediapipe stuff
|
122 |
+
4. import the low poly mediapipe face
|
123 |
+
5. snap the mesh to the high poly model
|
124 |
+
6. model the rest of the low poly model
|
125 |
+
7. bake the normal / etc maps to the low poly face model
|
126 |
+
8. it's just that easy 😛
|
127 |
+
|
128 |
+
Ideally it would be a plugin...
|
129 |
""")
|
130 |
|
131 |
with gr.Row():
|