Tutorial for embedding 3D interactive graphics into PDF

by Guest on March 7, 2012

Josh Peek (@jegpeek) is a Hubble Fellow at Columbia University, specializing in the ISM in and around disk galaxies. He has a fascination with data presentation and design.

As an astronomer studying the complex three-dimensional structures of the interstellar medium, I’ve been taken with the idea of presenting that information in a compelling and interactive way to readers. The major mode of communication for astronomers is the refereed journal article, as distributed through PDF, so I got interested in how one can package interactive 3D scenes with the papers we write. Interactive graphics can be embedded in PDFs that can be rotated, panned, and zoomed.

An screenshot of a 3D scene of high velocity clouds around the Milky Way as viewed with Adobe Reader 10.1.2. Download the PDF and view it in Adobe Reader to interact with it.

I’ve written a tutorial which distills down the techniques I’ve found and developed for creating interactive 3D graphics. Topics include getting your data into a 3D format, choosing software to create the 3D object (.u3d), and using LaTex and the movie15 package to embed the object.

I think I’ve made some major strides towards making the process more streamlined; with an afternoon’s work you could make your first 3D PDF, and perhaps even add it to your next paper!

Check out the example (in Adobe Reader, not Preview). Make your own and let us know how it goes in the comments. Would also be great to have some more examples to showcase in the tutorial!

{ 9 comments… read them below or add one }

1 Ryan T. Hamilton March 7, 2012 at 1:39 pm

One suggestion: Could the static render that shows up if your PDF viewer isn’t Adobe be modified to show multiple views of the scene instead of just one? Then you’d have the best of both worlds, having interactivity for those with Adobe and a more/better views for everyone else. I’m likely to not install Adobe Reader again, as I tend to stick towards open source things as much as research-ly possible.

One critique: A well shaded/rendered viewpoints of the scene or a link to a slow fly-around video hosted on YouTube/Vimeo/wherever is much simpler, and I’d argue that giving the user less control forces them to look at what you want them to notice. A more complex video with scripted camera movements or transitions would be even better, and lends itself beautifully to public talks and online interactions with laypeople as well.

Overall though, neat!


2 Josh Peek March 18, 2012 at 5:27 pm

Hi Ryan,

The static figure can be anything you can put in a jpeg or png. So, yeah! I think you are right that multiple views might be the right thing for many situations.

I have to disagree with your second point. What I want to give the reader is a “limited sandbox” — a way for them to interact with the data in a limited way. That is, after all, how we learn things. Your prof can tell you all she wants about Maxwell’s equations, but until you get your hands dirty in the limited space of a problem set, none of it will stick. Note the ability to preset views, with specifc elements highlighted. You can, in the figure caption, describe what each preset view is showing, which allows you to guide the reader’s interpretation of the space, while still allowing them to explore.

3 Frédéric Vogt March 7, 2012 at 5:46 pm

3D .pdfs indeed are getting more trendy as time goes by. Yet, as you mention in your tutorial (good to see one, thanks for that), getting to the .u3d format is still quite a pain. Just to add my stone to the edifice :

I am using Python and MayaVi to plot my IFU data cubes in 3D. I export them in the .vrml format, and then use the software pdf3d to go to .u3d. It cost ~700$ for educational institutions, and is designed to export 3D models of (almost) any format to .u3d. Very specific (and not free), but extremely efficient – and they have a Linux version, if like me you have no access to a windows machine …

Regarding Ryan’s comment, you can pre-register an animation of your model with pdf3d for the user to look at when loading the model, while still giving him the opportunity to interact with it as he wishes.

And regarding Ryan’s other comment to replace the original static render by multiple views for people reading the paper version of the article – why not use stereo pairs, and give them too a flavor of 3D ? For example (shameless plug ;-)): http://arxiv.org/abs/1107.2715

Cheers !


4 Josh Peek March 18, 2012 at 6:16 pm

I like how the two comments so far are “why isn’t it open source?” and “What about spending $700 bucks?”. 🙂

I gotta admit, the stereo pairs paper is pretty cool! Nicely done sir.

5 Michail Vidiassov August 6, 2012 at 3:24 am

A couple of notes:

u3d is not the only model format for 3D PDF.
Adobe switched its development efforts to PRC format (at about 2006) and later sold the development team to Tech Soft 3D (a couple of yeas ago). Tetra 4D now markets that technology to end-users (Windows only).

There is some FOSS code to produce PRC originating from Asymptote project.
The new version of S2PLOT is going to use that code to output 3D PDF directly, without external converters.

BTW, pdf3d claims to have VTK->3D PDF converter.


6 Ian C October 18, 2012 at 11:47 am

Regarding comments on embedding 3D interactive graphics into PDF, to clarify on comments by Frédéric & Michael:
– Confirming that PDF3DReportGen is a commercial app, not FOSS
– U3D, PRC & 3D PDF files can be produced, converted from .vtk, .vrml, 70+ other 3D formats
– I think I have seen that both U3D and PRC could be embedded into LaTex, maybe Michael could provide a reference to LaTex+PRC?
– LaTex generated PDFs can be post-processed to add the 3D Views, avoiding macros and Movie15 steps.
– Simple camera spin animation & set of camera preset views are added for various standard view points. If VRML is input, then any camera views in the VRML stream are also added to the PDF scene.
– Windows, Linux, MacOSX platforms
– command-line VTK to 3D PDF (PRC) also exists, but is not part of PDF3DReportGen package, however PDF3DReportGen also runs as command-line python scripting.
This is a little more info than warranted as a comment on your blog, I hope it adds a little to the discussion.


7 Kat Barger October 22, 2012 at 11:13 pm

Very cool Josh! We were all blown away when Mary Putman showed this PDF at the Gas Flows in Galaxies Conference and the Baryon Cycle conference. I really like how your PDF illustrates the high velocity cloud distribution. We always work in covering fractions and inflow rates, it’s nice to have a unique perspective on how the neutral circumgalactic medium is distributed around the Milky Way now that we finally have the distances measured to these objects. You can really see right away the Magellanic Stream just dominates the sky (views -> Magellanic Stream [Physical]). Thanks for posting this!


8 3d graphics September 18, 2013 at 9:38 am

Thanks Josh for this tutorial.


9 Brendan April 30, 2014 at 3:30 am

Bentley View is free and will import various cad formats. It will ‘print’ a 3D pdf.


Leave a Comment

Previous post:

Next post: