使用 assimp 导出 3D 模型而不重新索引顶点
Exporting 3D models with assimp without re-indexing vertices
我正在使用 assimp.net 导出我的 3d 模型。 assimp 将重新索引导出模型中的顶点!我需要以前的索引顺序。有没有办法在导出的模型中保存以前的索引?
正在导出代码:
using (var asmpCntx = new AssimpContext())
{
LogStream.IsVerboseLoggingEnabled = true;
using (var pipe = new LogPipe(_logStore))
{
return asmpCntx.ExportFile(_raw, "MyExportedFile.obj", "obj");
}
}
预期顺序:
130921 vertex positions
v -0.111804 -0.257020 0.282297
v -0.110387 -0.261969 0.278314
v -0.103693 -0.262174 0.281221
v -0.105030 -0.257238 0.285222
v -0.106187 0.409742 0.238732
v -0.106169 0.403559 0.240970
v -0.100297 0.403623 0.242419
v -0.100294 0.409780 0.240066
v -0.585048 -0.776799 -0.674764
v -0.588571 -0.779106 -0.672874
v -0.584674 -0.779821 -0.668612
v -0.581676 -0.777379 -0.670708
v -0.064894 -0.808259 -0.292862
v -0.065003 -0.813085 -0.296292
v -0.056978 -0.813406 -0.295237
v -0.056888 -0.808645 -0.291699
...
f 1/1/1 2/2/2 3/3/3 4/4/4
f 5/5/5 6/6/6 7/7/7 8/8/8
f 9/9/9 10/10/10 11/11/11 12/12/12
f 13/13/13 14/14/14 15/15/15 16/16/16
f 17/17/17 18/18/18 19/19/19 20/20/20
f 21/21/21 22/22/22 23/23/23 24/24/24
f 25/25/25 26/26/26 27/27/27 28/28/28
f 29/29/29 30/30/30 31/31/31 32/32/32
f 33/33/33 34/34/34 35/35/35 36/36/36
f 37/37/37 38/38/38 39/39/39 40/40/40
f 41/41/41 42/42/42 43/43/43 44/44/44
f 45/45/45 46/46/46 47/47/47 48/48/48
f 49/49/49 50/50/50 51/51/51 52/52/52
f 53/53/53 54/54/54 55/55/55 56/56/56
f 57/57/57 58/58/58 59/59/59 60/60/60
f 61/61/61 62/62/62 63/63/63 64/64/64
...
导出订单:
130921 vertex positions
v -0.111804 -0.25702 0.282297
v -0.110387 -0.261969 0.278314
v -0.103693 -0.262174 0.281221
v -0.10503 -0.257238 0.285222
v -0.10243 -0.267136 0.27725
v -0.095897 -0.267675 0.280051
v -0.097084 -0.262695 0.284046
v -0.098237 -0.25754 0.287812
v -0.112767 -0.251395 0.285155
v -0.1062 -0.251911 0.288609
v -0.09934 -0.252212 0.291206
v -0.113301 -0.245382 0.287103
v -0.106914 -0.245987 0.290933
v -0.119279 -0.251091 0.281232
v -0.119601 -0.244982 0.282834
v -0.113586 -0.239219 0.288503
...
f 1/1/1 2/2/2 3/3/3
f 1/1/1 3/3/3 4/4/4
f 2/2/2 5/5/5 3/3/3
f 3/3/3 5/5/5 6/6/6
f 3/3/3 6/6/6 7/7/7
f 4/4/4 3/3/3 7/7/7
f 4/4/4 7/7/7 8/8/8
f 9/9/9 1/1/1 4/4/4
f 9/9/9 4/4/4 10/10/10
f 10/10/10 4/4/4 8/8/8
f 10/10/10 8/8/8 11/11/11
f 12/12/12 9/9/9 10/10/10
f 12/12/12 10/10/10 13/13/13
f 13/13/13 10/10/10 11/11/11
f 14/14/14 1/1/1 9/9/9
f 15/15/15 14/14/14 9/9/9
...
Asset-Importer-Lib 将对几何进行优化。所以我们不能保证你的顶点顺序不会改变。
我正在使用 assimp.net 导出我的 3d 模型。 assimp 将重新索引导出模型中的顶点!我需要以前的索引顺序。有没有办法在导出的模型中保存以前的索引?
正在导出代码:
using (var asmpCntx = new AssimpContext())
{
LogStream.IsVerboseLoggingEnabled = true;
using (var pipe = new LogPipe(_logStore))
{
return asmpCntx.ExportFile(_raw, "MyExportedFile.obj", "obj");
}
}
预期顺序:
130921 vertex positions
v -0.111804 -0.257020 0.282297
v -0.110387 -0.261969 0.278314
v -0.103693 -0.262174 0.281221
v -0.105030 -0.257238 0.285222
v -0.106187 0.409742 0.238732
v -0.106169 0.403559 0.240970
v -0.100297 0.403623 0.242419
v -0.100294 0.409780 0.240066
v -0.585048 -0.776799 -0.674764
v -0.588571 -0.779106 -0.672874
v -0.584674 -0.779821 -0.668612
v -0.581676 -0.777379 -0.670708
v -0.064894 -0.808259 -0.292862
v -0.065003 -0.813085 -0.296292
v -0.056978 -0.813406 -0.295237
v -0.056888 -0.808645 -0.291699
...
f 1/1/1 2/2/2 3/3/3 4/4/4
f 5/5/5 6/6/6 7/7/7 8/8/8
f 9/9/9 10/10/10 11/11/11 12/12/12
f 13/13/13 14/14/14 15/15/15 16/16/16
f 17/17/17 18/18/18 19/19/19 20/20/20
f 21/21/21 22/22/22 23/23/23 24/24/24
f 25/25/25 26/26/26 27/27/27 28/28/28
f 29/29/29 30/30/30 31/31/31 32/32/32
f 33/33/33 34/34/34 35/35/35 36/36/36
f 37/37/37 38/38/38 39/39/39 40/40/40
f 41/41/41 42/42/42 43/43/43 44/44/44
f 45/45/45 46/46/46 47/47/47 48/48/48
f 49/49/49 50/50/50 51/51/51 52/52/52
f 53/53/53 54/54/54 55/55/55 56/56/56
f 57/57/57 58/58/58 59/59/59 60/60/60
f 61/61/61 62/62/62 63/63/63 64/64/64
...
导出订单:
130921 vertex positions
v -0.111804 -0.25702 0.282297
v -0.110387 -0.261969 0.278314
v -0.103693 -0.262174 0.281221
v -0.10503 -0.257238 0.285222
v -0.10243 -0.267136 0.27725
v -0.095897 -0.267675 0.280051
v -0.097084 -0.262695 0.284046
v -0.098237 -0.25754 0.287812
v -0.112767 -0.251395 0.285155
v -0.1062 -0.251911 0.288609
v -0.09934 -0.252212 0.291206
v -0.113301 -0.245382 0.287103
v -0.106914 -0.245987 0.290933
v -0.119279 -0.251091 0.281232
v -0.119601 -0.244982 0.282834
v -0.113586 -0.239219 0.288503
...
f 1/1/1 2/2/2 3/3/3
f 1/1/1 3/3/3 4/4/4
f 2/2/2 5/5/5 3/3/3
f 3/3/3 5/5/5 6/6/6
f 3/3/3 6/6/6 7/7/7
f 4/4/4 3/3/3 7/7/7
f 4/4/4 7/7/7 8/8/8
f 9/9/9 1/1/1 4/4/4
f 9/9/9 4/4/4 10/10/10
f 10/10/10 4/4/4 8/8/8
f 10/10/10 8/8/8 11/11/11
f 12/12/12 9/9/9 10/10/10
f 12/12/12 10/10/10 13/13/13
f 13/13/13 10/10/10 11/11/11
f 14/14/14 1/1/1 9/9/9
f 15/15/15 14/14/14 9/9/9
...
Asset-Importer-Lib 将对几何进行优化。所以我们不能保证你的顶点顺序不会改变。