title: Saving rgl 3D scene to u3d (for .pdf integration)
body: <p>I have a 3D scene generated with the R rgl package.</p>
  
  <ul>
  <li>I can save it in RTL and OBJ format via the rgl functions, but these functions don't support colors.</li>
  <li>I can save it in WebGL, but then I can't find a WebGL to .u3d converter, nor any way to insert WebGL content in a .pdf file (generated with LaTeX).</li>
  <li><p>I can save it in PLY format and then export to .u3d (e.g. using Meshlab), but it gives me the following error:</p>
  
  <pre><code>Error in if (sum(normals[1:3, it[j, i]] * normal) &lt; 0) normals[, it[j,  : 
  missing value where TRUE/FALSE needed 
  </code></pre></li>
  </ul>
  
  <p>Which I really don't know how to solve.</p>
  
  <p><a href="https://drive.google.com/file/d/0BxlZ3Tjj36sNcXR6RDRfcXNPNVk/view?usp=sharing">Here</a> is an example file to reproduce the problem.
  To reproduce simply download the file in the working directory, execute R and run:</p>
  
  <pre><code>library(rgl)
  load("alps3d.Rdata") #This loads the alps3d variable
  plot3d(alps3d)
  writePLY("alps3d.ply")
  </code></pre>
  
  <p>How can I save the 3d scene in a format which can be itegrated in a .pdf using LaTeX?</p>