Maya - three.js с помощью convert_obj_three.py

Допустим, у меня есть файл obj от Maya2014, как показано ниже.

aaaaaa.obj

# This file uses centimeters as units for non-parametric coordinates.

mtllib aaaaaa.mtl
g default
v 7.584940 0.000000 3.298261
v 7.416561 0.000000 2.235156
v 6.927905 0.000000 1.276115
v 6.166806 0.000000 0.515016
v 5.207765 0.000000 0.026360
v 4.144660 0.000000 -0.142020
v 3.081555 0.000000 0.026360
v 2.122514 0.000000 0.515016
v 1.361415 0.000000 1.276115
v 0.872759 0.000000 2.235156
v 0.704380 0.000000 3.298261
v 0.872759 0.000000 4.361366
v 1.361415 0.000000 5.320407
v 2.122514 0.000000 6.081506
v 3.081555 0.000000 6.570162
v 4.144660 0.000000 6.738542
v 5.207766 0.000000 6.570162
v 6.166807 0.000000 6.081507
v 6.927906 0.000000 5.320407
v 7.416562 0.000000 4.361366
v 7.584940 6.330827 3.298261
v 7.416561 6.330827 2.235156
v 6.927905 6.330827 1.276115
v 6.166806 6.330827 0.515016
v 5.207765 6.330827 0.026360
v 4.144660 6.330827 -0.142020
v 3.081555 6.330827 0.026360
v 2.122514 6.330827 0.515016
v 1.361415 6.330827 1.276115
v 0.872759 6.330827 2.235156
v 0.704380 6.330827 3.298261
v 0.872759 6.330827 4.361366
v 1.361415 6.330827 5.320407
v 2.122514 6.330827 6.081506
v 3.081555 6.330827 6.570162
v 4.144660 6.330827 6.738542
v 5.207766 6.330827 6.570162
v 6.166807 6.330827 6.081507
v 6.927906 6.330827 5.320407
v 7.416562 6.330827 4.361366
v 9.484939 6.330827 3.298261
v 9.223568 6.330827 1.648023
v 8.465038 6.330827 0.159323
v 7.283598 6.330827 -1.022117
v 5.794897 6.330827 -1.780647
v 4.144660 6.330827 -2.042019
v 2.494423 6.330827 -1.780647
v 1.005722 6.330827 -1.022116
v -0.175717 6.330827 0.159323
v -0.934248 6.330827 1.648024
v -1.195619 6.330827 3.298261
v -0.934248 6.330827 4.948499
v -0.175717 6.330827 6.437199
v 1.005723 6.330827 7.618638
v 2.494424 6.330827 8.377169
v 4.144661 6.330827 8.638540
v 5.794899 6.330827 8.377169
v 7.283599 6.330827 7.618637
v 8.465038 6.330827 6.437198
v 9.223570 6.330827 4.948497
v 9.484939 0.000000 3.298261
v 9.223568 0.000000 1.648023
v 8.465038 0.000000 0.159323
v 7.283598 0.000000 -1.022117
v 5.794897 0.000000 -1.780647
v 4.144660 0.000000 -2.042019
v 2.494423 0.000000 -1.780647
v 1.005722 0.000000 -1.022116
v -0.175717 0.000000 0.159323
v -0.934248 0.000000 1.648024
v -1.195619 0.000000 3.298261
v -0.934248 0.000000 4.948499
v -0.175717 0.000000 6.437199
v 1.005723 0.000000 7.618638
v 2.494424 0.000000 8.377169
v 4.144661 0.000000 8.638540
v 5.794899 0.000000 8.377169
v 7.283599 0.000000 7.618637
v 8.465038 0.000000 6.437198
v 9.223570 0.000000 4.948497
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 63308267520.000000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 0.000000 0.500000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 2.000000 63308267520.000000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vt 0.000000 63308267520.000000
vt 2.000000 0.500000
vn -0.951057 0.000000 0.309017
vn -1.000000 0.000000 0.000001
vn -1.000000 0.000000 0.000001
vn -0.951057 0.000000 0.309017
vn -0.809017 0.000000 0.587785
vn -0.809017 0.000000 0.587785
vn -0.587786 0.000000 0.809017
vn -0.587786 0.000000 0.809017
vn -0.309017 0.000000 0.951057
vn -0.309017 0.000000 0.951057
vn 0.000000 0.000000 1.000000
vn 0.000000 0.000000 1.000000
vn 0.309017 0.000000 0.951057
vn 0.309017 0.000000 0.951057
vn 0.587785 0.000000 0.809017
vn 0.587785 0.000000 0.809017
vn 0.809017 0.000000 0.587785
vn 0.809017 0.000000 0.587785
vn 0.951057 0.000000 0.309017
vn 0.951057 0.000000 0.309017
vn 1.000000 0.000000 0.000000
vn 1.000000 0.000000 0.000000
vn 0.951057 0.000000 -0.309017
vn 0.951057 0.000000 -0.309017
vn 0.809017 0.000000 -0.587785
vn 0.809017 0.000000 -0.587785
vn 0.587785 0.000000 -0.809017
vn 0.587785 0.000000 -0.809017
vn 0.309017 0.000000 -0.951056
vn 0.309017 0.000000 -0.951056
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn -0.309017 0.000000 -0.951057
vn -0.309017 0.000000 -0.951057
vn -0.587785 0.000000 -0.809017
vn -0.587785 0.000000 -0.809017
vn -0.809017 0.000000 -0.587785
vn -0.809017 0.000000 -0.587785
vn -0.951057 0.000000 -0.309016
vn -0.951057 0.000000 -0.309016
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 -0.000000
vn 0.000000 1.000000 0.000000
vn 0.000000 1.000000 0.000000
vn 0.951057 0.000000 -0.309017
vn 1.000000 0.000000 -0.000001
vn 1.000000 0.000000 -0.000001
vn 0.951057 0.000000 -0.309017
vn 0.809017 0.000000 -0.587785
vn 0.809017 0.000000 -0.587785
vn 0.587785 0.000000 -0.809017
vn 0.587785 0.000000 -0.809017
vn 0.309017 0.000000 -0.951057
vn 0.309017 0.000000 -0.951057
vn 0.000000 0.000000 -1.000000
vn 0.000000 0.000000 -1.000000
vn -0.309017 0.000000 -0.951057
vn -0.309017 0.000000 -0.951057
vn -0.587785 0.000000 -0.809017
vn -0.587785 0.000000 -0.809017
vn -0.809017 0.000000 -0.587785
vn -0.809017 0.000000 -0.587785
vn -0.951057 0.000000 -0.309017
vn -0.951057 0.000000 -0.309017
vn -1.000000 0.000000 0.000000
vn -1.000000 0.000000 0.000000
vn -0.951057 0.000000 0.309017
vn -0.951057 0.000000 0.309017
vn -0.809017 0.000000 0.587785
vn -0.809017 0.000000 0.587785
vn -0.587785 0.000000 0.809017
vn -0.587785 0.000000 0.809017
vn -0.309017 0.000000 0.951057
vn -0.309017 0.000000 0.951057
vn -0.000000 0.000000 1.000000
vn -0.000000 0.000000 1.000000
vn 0.309017 0.000000 0.951057
vn 0.309017 0.000000 0.951057
vn 0.587786 0.000000 0.809017
vn 0.587786 0.000000 0.809017
vn 0.809017 0.000000 0.587785
vn 0.809017 0.000000 0.587785
vn 0.951057 0.000000 0.309017
vn 0.951057 0.000000 0.309017
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 -0.000000
vn 0.000000 -1.000000 0.000000
vn 0.000000 -1.000000 0.000000
s 1
g pPipe1
usemtl initialShadingGroup
f 2/1/1 1/2/2 21/61/3 22/62/4
f 3/5/5 2/1/1 22/62/4 23/63/6
f 4/7/7 3/5/5 23/63/6 24/64/8
f 5/9/9 4/7/7 24/64/8 25/65/10
f 6/11/11 5/9/9 25/65/10 26/66/12
f 7/13/13 6/11/11 26/66/12 27/67/14
f 8/15/15 7/13/13 27/67/14 28/68/16
f 9/17/17 8/15/15 28/68/16 29/69/18
f 10/19/19 9/17/17 29/69/18 30/70/20
f 11/21/21 10/19/19 30/70/20 31/71/22
f 12/23/23 11/21/21 31/71/22 32/72/24
f 13/25/25 12/23/23 32/72/24 33/73/26
f 14/27/27 13/25/25 33/73/26 34/74/28
f 15/29/29 14/27/27 34/74/28 35/75/30
f 16/31/31 15/29/29 35/75/30 36/76/32
f 17/33/33 16/31/31 36/76/32 37/77/34
f 18/35/35 17/33/33 37/77/34 38/78/36
f 19/37/37 18/35/35 38/78/36 39/79/38
f 20/39/39 19/37/37 39/79/38 40/80/40
f 1/2/2 20/39/39 40/80/40 21/61/3
s 2
f 22/4/41 21/3/42 41/81/43 42/83/44
f 23/6/45 22/4/41 42/83/44 43/85/46
f 24/8/47 23/6/45 43/85/46 44/87/48
f 25/10/49 24/8/47 44/87/48 45/89/50
f 26/12/51 25/10/49 45/89/50 46/91/52
f 27/14/53 26/12/51 46/91/52 47/93/54
f 28/16/55 27/14/53 47/93/54 48/95/56
f 29/18/57 28/16/55 48/95/56 49/97/58
f 30/20/59 29/18/57 49/97/58 50/99/60
f 31/22/61 30/20/59 50/99/60 51/101/62
f 32/24/63 31/22/61 51/101/62 52/103/64
f 33/26/65 32/24/63 52/103/64 53/105/66
f 34/28/67 33/26/65 53/105/66 54/107/68
f 35/30/69 34/28/67 54/107/68 55/109/70
f 36/32/71 35/30/69 55/109/70 56/111/72
f 37/34/73 36/32/71 56/111/72 57/113/74
f 38/36/75 37/34/73 57/113/74 58/115/76
f 39/38/77 38/36/75 58/115/76 59/117/78
f 40/40/79 39/38/77 59/117/78 60/119/80
f 21/3/42 40/40/79 60/119/80 41/81/43
s 3
f 42/83/81 41/81/82 61/82/83 62/84/84
f 43/85/85 42/83/81 62/84/84 63/86/86
f 44/87/87 43/85/85 63/86/86 64/88/88
f 45/89/89 44/87/87 64/88/88 65/90/90
f 46/91/91 45/89/89 65/90/90 66/92/92
f 47/93/93 46/91/91 66/92/92 67/94/94
f 48/95/95 47/93/93 67/94/94 68/96/96
f 49/97/97 48/95/95 68/96/96 69/98/98
f 50/99/99 49/97/97 69/98/98 70/100/100
f 51/101/101 50/99/99 70/100/100 71/102/102
f 52/103/103 51/101/101 71/102/102 72/104/104
f 53/105/105 52/103/103 72/104/104 73/106/106
f 54/107/107 53/105/105 73/106/106 74/108/108
f 55/109/109 54/107/107 74/108/108 75/110/110
f 56/111/111 55/109/109 75/110/110 76/112/112
f 57/113/113 56/111/111 76/112/112 77/114/114
f 58/115/115 57/113/113 77/114/114 78/116/116
f 59/117/117 58/115/115 78/116/116 79/118/118
f 60/119/119 59/117/117 79/118/118 80/120/120
f 41/81/82 60/119/119 80/120/120 61/82/83
s 4
f 62/42/121 61/41/122 1/2/123 2/1/124
f 63/43/125 62/42/121 2/1/124 3/5/126
f 64/44/127 63/43/125 3/5/126 4/7/128
f 65/45/129 64/44/127 4/7/128 5/9/130
f 66/46/131 65/45/129 5/9/130 6/11/132
f 67/47/133 66/46/131 6/11/132 7/13/134
f 68/48/135 67/47/133 7/13/134 8/15/136
f 69/49/137 68/48/135 8/15/136 9/17/138
f 70/50/139 69/49/137 9/17/138 10/19/140
f 71/51/141 70/50/139 10/19/140 11/21/142
f 72/52/143 71/51/141 11/21/142 12/23/144
f 73/53/145 72/52/143 12/23/144 13/25/146
f 74/54/147 73/53/145 13/25/146 14/27/148
f 75/55/149 74/54/147 14/27/148 15/29/150
f 76/56/151 75/55/149 15/29/150 16/31/152
f 77/57/153 76/56/151 16/31/152 17/33/154
f 78/58/155 77/57/153 17/33/154 18/35/156
f 79/59/157 78/58/155 18/35/156 19/37/158
f 80/60/159 79/59/157 19/37/158 20/39/160
f 61/41/122 80/60/159 20/39/160 1/2/123

aaaaaa.mtl

newmtl initialShadingGroup
illum 4
Kd 0.50 0.50 0.50
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 1.00

Когда я пытаюсь преобразовать его с помощью convert_obj_three.py, я получаю ошибку ниже.

Я правильно установил Python3. *.

Что может быть проблемой? Как это исправить?

2 ответа

Это давало синтаксическую ошибку, поэтому я начал проверять синтаксис. что он действителен для python 2. + не для 3.+. то я просто удалил python 3. * и установил 2.75. не работает, как шарм.


У вас должен быть OBJ файл? Если нет, я предлагаю использовать майя для THREE экспортера, который поставляется с исходным кодом THREE.js. Он экспортирует непосредственно в формат.JS без промежуточного шага. Если вы загрузите репозиторий из GitHub, вы можете найти файлы экспортера в utils/exporters/maya.

Экспортер, который вы найдете в официальном репозитории THREE.js, поддерживает только статические модели. Я создал обновленную версию, которая также поддерживает экспорт сфальсифицированных и анимированных моделей. У нас есть запрос на перенос для интеграции обновленного экспортера с соединительной магистралью THREE, но если вы хотите сразу получить нового и улучшенного экспортера, вы можете получить его из этого репозитория: https://github.com/BlackTowerEntertainment/three.js/tree/maya_animation_exporter.

Надеюсь это поможет.

licensed under cc by-sa 3.0 with attribution.