从POV-Ray到RGL [英] From POV-Ray to rgl
问题描述
I've followed this tutorial to export a POV-Ray graphic to a STL
file, through Meshlab. I've also tried the export to the OBJ
format. Everything seems to work fine from the creation of the POV-Ray graphic to the exporting in Meshlab.
但是后来我尝试使用rgl
软件包的readSTL
和readOBJ
函数在R中渲染图形,而问题就在这里.
But then I've tried to render the graphic in R with the functions readSTL
and readOBJ
of the rgl
package, and the problem is here.
实际上,导出的STL
文件为空:
In fact, the exported STL
file is empty:
solid STL generated by MeshLab
endsolid vcg
因此,当然rgl::readSTL
在R中什么也不呈现.
So, of course, rgl::readSTL
renders nothing in R.
OBJ
文件不为空,但不包含面(仅包含顶点和顶点法线):
The OBJ
file is not empty, but it contains no faces (only vertices and vertex normals):
####
#
# OBJ File Generated by Meshlab
#
####
# Object blob.obj
#
# Vertices: 8437
# Faces: 0
#
####
vn -0.900372 -0.267658 -0.343060
v -4.000525 2.600000 -0.833225
......
在R中运行rgl::readOBJ
后,渲染只是一个白色场景,什么也没有.即使没有面子,我们也有望获得一些积分.
After running rgl::readOBJ
in R the rendering is just a white scene, there's nothing. Even if there's no face, we could expect to get some points.
也许我在程序的一个步骤中弄错了.您对以下方面有任何想法吗?
Maybe I'm mistaken during one step of the procedure. Do you have any idea about:
-
如何在Meshlab中导出到非空的
STL
文件?
如何在R中获得readOBJ
的积分?
how to get the points with readOBJ
in R ?
从Meshlab导出时如何在OBJ
文件中获取人脸?
how to get the faces in the OBJ
file when exporting from Meshlab ?
您是否知道从POV-Ray到rgl
的另一种方法,如果可能的话,还可以保留颜色?
do you know another way to go from POV-Ray to rgl
, if possible preserving the colors ?
我找到了一种在OBJ
文件中获取人脸的方法:像在tuto中所说的那样,不是在Meshlab中执行 Screened Poisson Surface Reconstruction ,而是执行 Surface Reconstruction :球旋转.
I've found a way to get the faces in the OBJ
file: instead of doing Screened Poisson Surface Reconstruction in Meshlab, as said in the tuto, I do Surface Reconstruction: Ball Pivoting.
但随后rgl::readOBJ
会产生此错误:
Error in order(vlinks[[i]][, 2]) : argument 1 is not a vector
相同的过程允许导出非空的STL
文件.但是随后rgl::readSTL
会产生此错误:
The same procedure allows to export a non-empty STL
file. But then rgl::readSTL
generates this error:
Error in matrix(NA, 3 * n, 3) : invalid 'nrow' value (too large or NA)
In addition: Warning message:
In matrix(NA, 3 * n, 3) : NAs introduced by coercion to integer range
推荐答案
好,我发现了.
-
按照链接的tuto在POV-Ray中创建文件
blob.asc
在Meshlab中,打开此文件,然后在菜单过滤器"->重新网格化,简化和重建" 中进行表面重建:球形旋转.我不知道,也许以前以前需要做过筛分泊松表面重建" .
In Meshlab, open this file, and do Surface Reconstruction: Ball Pivoting in the menu Filters -> Remeshing, Simplification and Reconstruction. Perhaps one previously needs to do Screened Poisson Surface Reconstruction before, I don't know.
将文件导出为STL
. 选中二进制编码" (默认选项),因为rgl::readSTL
仅读取二进制STL
文件,而不读取ASCII文件.
Export the file as STL
. Check "Binary Encoding" (a default option), because rgl::readSTL
reads binary STL
files only, not ASCII files.
在R中,现在您可以执行rgl::readSTL
.这可行:
In R, now you can do rgl::readSTL
. And this works:
这篇关于从POV-Ray到RGL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!