Publishing or Sharing 3D Documentation: U3D and PDF

0
758

After overcoming the numerous difficulties of creating the first 3D models by photogrammetry, or rather by SfM, with Open Source tools, it is perhaps time to start worrying about how to distribute or publish 3D documents, since the possibilities regarding accessibility to such documents are not many, as generally the visualization of these documents is closely linked to proprietary viewers of the formats we use for 3D data exchange.

Throughout several articles I will explore some of the most common, or at least accessible, 3D publishing possibilities, the first of which is the possibility of publishing 3D objects or movies through PDF documents which, although it was a proprietary Adobe format for many years, in 2008 it was released as an open standard according to ISO 3200-1, so it may not be a bad option to publish 3D models.

Since 2007 and Acrobat version 7, it has supported 3D objects; however, it was not until recently in 2012 that the 3D PDF Consortium was created for the development and standardization of 3D support in these documents, since until now, the ability to render 3D objects embedded in PDFs is an almost exclusive feature of the official Adobe Acrobat viewer, not being supported, for example, by tools like Mac OS X Preview, which means that publishing under PDF poses a certain problem of accessibility and long-term preservation, as we do not know the direction this standardization may take.

Currently, it is only possible to use 3D objects in U3D (Universal 3D) format, a very common format that we can easily generate with Meshlab, or the PRC (Product Representation Compact) format, a data exchange format closely linked to Adobe since 2006, and not very widespread in the free software world.

Creating a 3D PDF document with Adobe Acrobat PRO is really simple, as we only have to choose our U3D file from the tools menu > Multimedia > 3D Tool and adjust the layout and visualization options, so it does not pose excessive difficulty.

Another alternative, free and somewhat more attractive, is to use LaTeX to generate these documents completely freely. Without going too deep into the subject, LaTeX is the open-source typesetting language par excellence with significant implementation in scientific fields, due to its versatility when drawing formulas and models of all kinds. Along with these advantages, options to embed 3D objects are included.

To write in LaTeX we can use very popular cross-platform free editors such as Textmaker which, for example, for Mac OS X environments requires the accompanying package BasicTeX. Using Textmaker as an editor, once the roughness of the LaTeX language for users unfamiliar with tag-based languages is overcome, is quite straightforward.

As an example, the code to load a 3D object in a PDF is as follows:

\documentclass[a4paper]{article}
\usepackage[3D]{movie15}
\usepackage[UKenglish]{babel}
\usepackage[colorlinks=true]{hyperref} 
\begin{document}
\title{The Queen Of the Night.Babylonia 1972-1750 BC}
\author{Jos\'e Pereira\\ \href{https://www.jpereira.net}{https://www.jpereira.net}}
\maketitle
\begin{center}
\includemovie[
        poster,
        toolbar,
        label=diosa.u3d
        text=(diosa.u3d),
        3Dlights=CAD,
        3Daac=16, 3Droll=-1.18, 3Dc2c=0 8.54 0, 3Droo=8.54, 3Dcoo=-0.01 0.43 -0.11,
]{\linewidth}{\linewidth}{diosa.u3d}
\label{ex3d} An example of publishing 3D objects in U3D format via PDF using LaTeX.
\end{center}
\end{document}

Where the includemovie tag is responsible for the actual loading of the 3D object and the rest are the usual tags of any document, and diosa.u3d is the path to our U3D document. The process is quite simple except for the parameters 3Daac, 3Droll, 3Droo, and 3Dcoo which indicate the initial position values of our 3D model relative to the observer; if the model is correctly positioned relative to the XYZ axes, then the default parameters may be sufficient:

3Daac=60.000000, 3Droll=0, 3Dc2c=0.000000 -100.000000 0.000000, 3Droo=100.000000, 3Dcoo=0 0 0

However, if we need to position the model for better presentation when opening the document, it is necessary to define these parameters, since if our model is not correctly positioned in our viewer, it can even become invisible to the observer.

Defining these parameters is somewhat complex due to the lack of tools to calculate them directly. The only method I know is to use Acrobat’s own navigation tool to help define them.

herramientas camara 3D PDF LaTexTo do this, with the cursor over our model, we open the context menu and select Tools > Camera Properties, and in position activate the Angle Units option.

To be able to set these parameters, first we will understand what they are and look for their equivalents in Acrobat’s camera menu:

  • 3Daac: This is the camera’s viewing angle or “Field of View”
  • 3Droll: The rotation of the camera around the axes or “Rotate”
  • 3Dcoo: The coordinates of the orbit center which coincide with the XYZ parameters of “Target”
  • 3Droo: The orbit radius, which initially coincides with the “Distance”
  • 3Dc2c: The camera position at the orbit center, described by three coordinates where the first two variables correspond to the fields “Altitude” and “Distance”

Thus, for my case, the parameters according to the information from the Acrobat viewer are:

3Daac=16, 3Droll=-1.18, 3Dc2c=0 8.54 0, 3Droo=8.54, 3Dcoo=-0.01 0.43 -0.11

Initially, no further calculations are necessary to correctly describe a 3D model in LaTeX; simply by enabling the option to compile as PDFLaTeX we can have our compiled PDF as in the example you can download below, but remember that it is only compatible with Adobe Acrobat viewers