How to embed Interactive 3D Models, Movies and Sound clips into a PDF via LaTeX?

This article explains how to embed 3D Models, Movies and Sound clips into a PDF via LaTeX. First I want you to have all the software that is needed, installed on your machine. I would assume, of course, you have LaTeX installed and ready. If not, you need to install a LaTeX distribution or system (Tex Live, MacTeX, MiKTeX , proTeXt) and then a good LaTeX Editor, I usually advise using TexStudio  but of course you can use any LaTeX Editor you would like.


LaTeX Packages Needed:

  1. Movie15 package:  It is a Multimedia inclusion package. This technology was in LaTeX from a zillion years ago. The package em­beds movies, sounds and 3D ob­jects into PDF doc­u­ments. Media9 is another package that also embeds in­ter­ac­tive Flash (SWF) and 3D ob­jects (manly formats like Adobe U3D & PRC). LUCKILY both packages are installed by default, even when you choose to install a minimum LaTeX distribution. So you do not have to worry.


  1. Meshlab free open source graphics authoring software for processing and editing 3D triangular meshes.

OBJ 3D model used in this tutorial

tree.obj link

Embedding Interactive 3D Models into the final PDF

If you look at the Movie15 package documentation -the super star package of this article- we can read the following:   “The PDF-1.6 specification, which was introduced with the advent of Adobe Acrobat/Reader 7, allows embedding of 3-dimensional graphic objects, such as CAD models or 3D scientific data, and lets the user interactively manipulate them. At the time of writing this documentation, the only supported file types were U3D [2] and Adobe’s PRC format, and only one commercial software [3] for exporting into the U3D format, yet from a number of CAD and 3D vectorformats, including DXF and VRML, was known.”

Actually in this article we are going to focus on embedding the U3D file format. But first we need to know: what is it? and second, how can we export other 3D file formats (Wavefront OBJ or glTF or Collada or X3D/VRML…) to U3D file format? First, let me start with explaining what is a U3D file format. U3D stands for “Universal 3D“. U3D is a compressed file format, designed to facilitate 3D data exchange and transmission and what is cool about it, is that it is supported by the PDF specification. The PDF that contains a U3D file format or PRC file format is normally known as PDF3D file.

The next question, how can we export our current model (which could be in OBJ, glTF, Collada) to the U3D file format? Well!! there are a lot of free tools that do that but the best is  Meshlab application. Why? Well, Meshlab do a crazy and cool thing which you will see later but be patient.

Go and Open up the Meshlab application and drag per example your .obj model into the main window of Meshlab. Wait for Meshlab to import the model. I am using in this tutorial, an OBJ model called tree.obj which has a resolution of 415 Vertices and 760 faces. As an advice, do not load very high resolution models because the PDF can not cope with that. If time allows, I will do in the future some performance measurements on this in the aim of discovering what is the highest resolution of 3D models we can embed safely into the PDF.

The tree.obj mesh loaded into Meshlab application
The tree.obj mesh loaded into Meshlab application

Go to File -> Export Mesh As,  A “Save As Dialog box” will open. From the “files of types” list choose U3D File Format. Change the name if needed to “tree.u3d”. Save in a different folder if you want (for tidiness sake). Now what happens is that you will get the following dialog box (Check the check boxes that I have checked as shown):

Choose Color for vertex and Color for Face. You probably have TexCoord is checked by default (if not check it please)
Check Color for vertex and Color for Face. You probably have TexCoord checked by default (if not, please check it – there are other options you can play with)

Click OK and  boom!. You would get in the folder: a tree.u3d (the actual 3D model) , and wait for it! wait for it!  wait for it!  wait for it! wait for it!   🙂 Ah come on! a tree.tex file.

Now the code in tree.tex is self-contained meaning if you build this document, you will get a PDF with the interactive 3D model in it. You can of course and this is what I usually do: copy the \includemovie[poster,toolbar,label=Tree.u3d, text=(tree.u3d),…]{…} into whatever LaTeX document you want (do not forget to add to the preamble of the document \usepackage[3D]{movie15} if you are aiming for 3D).

Most often people use 3D models in presentations so ideally they go very well in a Beamer PDF presentation slides. You can also disseminate 3D models on the web easily by using PDFs, so that is another good case to embed 3D Models into PDFs.

Let us say, in digital heritage context, you can create a full PDF document explaining about the importance and provenance of a certain heritage artefact and then embed into the same PDF document, an interactive 3D Model of the artefact with which people can interact. Any web browser that can present a PDF document, can also present a PDF with 3D (a.k.a PDF3D). It should be noted that the user have to accept and enable viewing 3D when the PDF opens, before viewing the 3D model(s) (the same way, a person needs to enable Macros in Microsoft Word or Microsoft Excel, in order to run the macros). The following is the content of LaTeX code needed to embed a U3D Model into PDF.

LaTeX Code to embed a model names tree.u3d into a PDF via LaTeX

toolbar, %same as `controls’
3Daac=60.000000, 3Droll=0.000000, 3Dc2c=0.042400 -2.141960 -0.553800, 3Droo=2.212800, 3Dcoo=0.042397 -0.094039 0.553841,

The result of course is awesome. See the following image:

Final Result
Final Result. The Tree 3D Model inside the PDF (Yay!!!)

Options and parameters to use for 3D models

….to be expanded further later…

Adding behaviour through JavaScript

You can add the “3Djscript” option to link to a file that defines objects behaviour in JavaScript.

toolbar, % `controls’

This will..

Adding several views for the 3D Object

toolbar, % `controls’

….to be expanded further later…

I will talk about changing light, background colour, rendering mode. Adding hyperlinks and extra controls.

Types of multimedia (audio, video, images) and 3D Models that Movie15 LaTeX Package supports

The following table is taken from the CTAN Movie15 LaTeX Package Documentation and shows the enormous amount of file types of audio, video, images and 3D Models that we can embed in our final PDFs.

Multimedia and 3D models File types supported by Movie15 Package
Multimedia and 3D models File types supported by Movie15 Package

Embedding Videos into the final PDF

….to be expanded further later…

Embedding Sound Clips into the final PDF

….to be expanded further later…

2 thoughts on “How to embed Interactive 3D Models, Movies and Sound clips into a PDF via LaTeX?”

  1. Hi Hussein.

    Thank you for taking the time to put this together.

    This blog post would be improved if you provided a link to a downloadable copy of the tree.obj file. Then, it simplifies following the steps, and reproducing what you did.

    1. Thank you for your comment. I have added a link to download the 3D model(tree.obj) used in the tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *