rmeshrglmeshlabpovray

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.

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.

In fact, the exported STL file is empty:

solid STL generated by MeshLab
endsolid vcg

So, of course, rgl::readSTL renders nothing in R.

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
......

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:

Update

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.

But then rgl::readOBJ generates this error:

Error in order(vlinks[[i]][, 2]) : argument 1 is not a vector

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

Solution

  • Ok, I've found.

    enter image description here