如何从.obj文件应用顶点颜色?

时间:2019-06-04 14:03:23

标签: python-3.x trimesh

点列表:

df <- structure(list(Gr1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("x", "y"), class = "factor"), 
    Gr2 = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 3L, 3L, 3L, 
    4L, 4L, 4L, 4L, 4L), .Label = c("x1", "x2", "y1", "y2"), class = "factor"), 
    ID = structure(c(1L, 2L, 3L, 4L, 5L, 4L, 5L, 7L, 8L, 9L, 
    6L, 7L, 8L, 9L, 10L), .Label = c("xa", "xb", "xc", "xd", 
    "xe", "ya", "yb", "yc", "yd", "ye"), class = "factor"), var1 = c(-0.56, 
    -0.23, 1.56, 0.07, 0.13, -0.69, -0.45, 0.36, 0.4, 0.11, 1.79, 
    0.5, -1.97, 0.7, -0.47), var2 = c(-1.07, -0.22, -1.03, -0.73, 
    -0.63, -1.14, 1.25, -0.3, 0.9, 0.88, 0.69, 0.55, -0.06, -0.31, 
    -0.38)), row.names = c(1L, 2L, 3L, 4L, 5L, 9L, 10L, 12L, 
13L, 14L, 16L, 17L, 18L, 19L, 20L), class = "data.frame")

我有一个http://cvl-demos.cs.nott.ac.uk/vrn/的obj文件 Bill Gates

您可以自己下载并尝试使用此工具,之后您可以下载.obj文件

来源:https://specials-images.forbesimg.com/imageserve/5c76b4b84bbe6f24ad99c370/416x416.jpg?background=000000&cropX1=0&cropX2=4000&cropY1=0&cropY2=4000

bill-gates.obj (带有 VERTEX颜色)包含以下内容:

PyOpenGL (3.1.0)
pyrender (0.1.24)
Shapely (1.6.4.post2)
trimesh (2.38.24)

我尝试了以下代码:

v 61.00 117.00 22.00 0.49 0.31 0.16
v 60.00 118.00 22.00 0.44 0.28 0.13
v 62.00 118.00 22.00 0.49 0.31 0.18
v 61.00 119.00 22.00 0.45 0.28 0.15
v 61.00 117.00 22.00 0.49 0.31 0.16
v 61.00 116.00 22.50 0.52 0.33 0.17
v 60.00 117.00 22.50 0.46 0.29 0.14
.... ....
.... ....
f 3630 2580 3628
f 2582 2580 3630
f 3632 2582 3630
f 3632 3635 2582
f 3635 2584 2582
f 3636 2585 2584
f 3636 2584 3637
f 3637 2584 3635
f 3637 3639 3638
f 3636 3637 3638
f 3639 3641 3640
f 3638 3639 3640
f 3641 3643 3642
f 3640 3641 3642

脸部颜色始终为灰色。

  1. 如何提取顶点颜色?
  2. 如何应用此顶点颜色?

============================

黑客

被劫持在github上,帮助我完成了以下指示: https://github.com/mikedh/trimesh/issues/448#issuecomment-498941973

0 个答案:

没有答案