<<setup, include=FALSE, cache=FALSE>>=
knit_hooks$set(rgl = hook_rgl)
x <- sort(rnorm(1000))
y <- rnorm(1000)
z <- rnorm(1000) + atan2(x,y)
plot3d(x, y, z, col = 'black')
It's possible, but just barely. You need to install Asymptote, and use
rgl::writeASY() to write a program for it. Then include that program in your document, run LaTeX, then Asymptote, then LaTeX again.
There are examples of including Asymptote in LaTeX here: http://asymptote.sourceforge.net/doc/LaTeX-usage.html#LaTeX-usage.
The results are kind of disappointing.
My advice would be to abandon PDF. HTML5 is a much better target for output;
rgl does quite a good job (using
rglwidget()) producing output for web pages. It's really unlikely that any effort will be put into improving PDF output, whereas fixing the remaining gaps in HTML support are a priority.