9

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)

Raffael
  • 1,251

2 Answers2

1

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.

0

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!