Take the 2-minute tour ×

Let's say I have a 3D scatter plot in R or a data frame with 3 fields filled with numeric data.

How can that be "turned" into "something" watchable on a 3D television (like a random big screen TV from Samsung using shutter goggles)? Either a static clip of that scatter plot turning around an axis or even better being able to interact with the plot (move it, turn it, ...). What programs, libraries do you need to get this done?

(I just brought up R because that's where the work is done. But a solution would not necessary have to include R)

share|improve this question
If you already have the 3D representation of the plot, then all you need is to create at least two views from it. These views have to differ in what they show by a minimal amount. So, if your "camera" would look at the plot from one angle, you'd slightly shift the camera to the left or right to get a second view. –  slhck Nov 28 '12 at 14:53
And then you need to encode the images to some sort of multi-view video the TV can handle, e.g. H.264 MVC or split stereo – do you have any specifics on that? –  slhck Nov 28 '12 at 14:58
@slhck: I don't really have the 3D representation of it. I just can have it displayed with R in 3D. Also using two camera persectives on a VRML representation maybe would handicap the interaction with the plot. Like adjusting the scales or using different data. :/ –  Raffael Nov 28 '12 at 15:30
Oh, I see. Well, that's going to be complicated. You'd need a graphics rendered that can output actual 3D from your computer's graphics card (e.g. an NVIDIA one with a 3D vision kit), but I'm unaware of such a thing. –  slhck Nov 28 '12 at 15:32
You need a graphics card that can output 3D (like the already-mentioned NVIDIA and 3D vision) and then a program that displays your data in a hardware-accelerated 3D viewport (similar to a video game). Processing (processing.org) might help you out in this regard. –  evilspoons Nov 28 '12 at 18:08

2 Answers 2

You could generate two images (for the left and right eyes) for each frame of your animation, set them up side-by-side (to make a very wide image, or a horizontally squashed one), and generate a video file that way. Then put that file onto a USB drive and plug it into a modern 3D TV, and look in its 3D menu, you should find a "side-by-side" or "SBS" option which will understand how to display the image. (Search YouTube for "GoPro 3D" for many examples.)

You might be able to do the same with a computer connected to the TV as a monitor, but the non-3D parts of the desktop would need to be hidden since they wouldn't be duplicated for each eye (and would look odd).

Note: If you do connect a computer to a 3D screen in SBS mode, you'll find it useful to close one eye at a time while navigating to start your presentation.

share|improve this answer

Really you just need spinnable plot3d(), from the rgl package.

  1. Start your plot's orientation in some particular, normal location.
  2. Create two instances of your base plot, rotated slightly in opposite directions (for fully centered lens-like view) or zoomed in and out slightly respectively (for more standard 3D view)

    x. Tint the plot further away more blue, equally tint the closer plot more red.

  3. Do not actually display the base plot. Preferably use the base to calculate a quad buffer (or double buffer) alternating which of the two offset plots is displayed in each frame. Update it each draw loop. Simultaneously display each instance plot after update.
  4. Using a high-resolution timer or VSync, play back the buffer stack at precisely the refresh rate of your given shutter glasses device.
  5. Hopefully the refresh rate is configurable in your app, plus the option to 'skip next frame' to sync up with the shutter glasses. (to reverse left/right sync)
  6. Before updating the base plot, scan input for user feedback, potentially from an asynchronously filled input buffer.
  7. Hook a laptop or small linux device up to the tv with HDMI lol.
  8. Bonus: If you really want to get down to it, you could use Rcpp and GLFW together to handle joystick/mouse/gamepad craziness.

There is a brief description of rgl and a similar package for 3D spinning plots, which can be seen at the end of this posting.

If you can, you'll want to place some sort of perspective-driven blur effect just sightly on each plot using OpenGL. Of course, you'll probably have to do a bit of tweaking with the angles to get it just right. If I recall it should be angle < 20 degrees,... but who knows, not me!

share|improve this answer
nope, sorry. I do know rgl and rgl supports anaglyph 3D from the box. I mention shutter goggles for a reason. but thanks anyway ;) –  Raffael Mar 20 at 6:29
@Яaffael whoops! did not actually see that about shutter glasses due to reading too quickly. Sorry for that, added some corrections. –  Garet Claborn Mar 20 at 7:03
You might also be able to use R with OpenCL/GL interop to achieve buffering and have a separate service write-only to the input buffers, giving your app read-only access to it. (Then you also need the reverse to send a message back to the service very quickly once an input has been read) Or very similarly, just have your app make the buffers and post the vertices to OpenCL and C++/OpenGL/OpenCL renderer running along side. –  Garet Claborn Mar 20 at 7:13
I deleted my question because I get too many of those not-relevant-answers (like yours so far :) but you're welcome to update it. –  Raffael Mar 20 at 7:54

Your Answer


