2D image of a FreeCAD object

The big question when it comes to scientific 3D data; how do you most efficiently present it? A 2D image isn’t really that optimal for it. This is my quest for the optimal solution.

I would prefer a universal solution for the presentation of 3D data and figures, which means that it works across different platforms and operating systems. My quest started with 3D enabled PDFs, since PDF stands for Portable Document Format and I thought this must be the optimal solution. I quickly realised it wasn’t really that optimal, due to two primal factors:

1. The 3D enhanced PDFs could only be interpreted by Desktop versions of Adobe Reader. This leaves out all UNIX, Linux, Mac, and Android systems. Even the iPad version of Adobe Reader is currently lacking 3D functions.
2. 3D enhanced PDFs are highly dependable on the u3d image format and it really isn’t that universal in Linux. I tried finding a converter/program for conversion of any 3D image format to u3d. The only programs that should have this capability, native to Linux, are MeshLab and Blender, which generally works excellent but they still lack a functioning plugin for u3d conversion.

The solution for a missing u3d-exporter in Linux? Crazy as it seems, the easiest solution here is to download a Windows-copy of MeshLab and Wine the whole thing. A pretty sad solution, however, which all to often needs to be applied in Linux to get some things to work properly.

So when we now have a u3d-image; how is a 3D enabled PDF created using LaTeX? Credits goes here to Nicola Rainiero and his excellent tutorial, with all the necessary files included for trying the whole thing out (check out the zip-file at the bottom of the page).

I will here briefly go through the different steps included and provide the relevant data.

The LaTeX code

\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{caption}
\usepackage{fancyref}
\usepackage[3D]{movie15} %the style package that enables 3D rendering
\usepackage[english]{babel}

\input glyphtounicode
\pdfgentounicode=1
\setlength{\parindent}{0pt}
\onehalfspace
\pagenumbering{roman}

\numberwithin{equation}{section}
%\numberwithin{figure}{section}
%\numberwithin{table}{section}

\captionsetup{font=small, labelfont=bf, width=0.95\textwidth} %define after textwidth
%\setlength{\abovecaptionskip}{0pt}
%\setlength{\belowcaptionskip}{7.5pt}

\begin{document}
\includemovie[poster,
toolbar,
label=pt,
text={\includegraphics[scale=1.0]{image2D.png}},
3Droo=6.896200246789337,
3Daac=60.000001669652114,
3Dcoo=0.6134188175201416 0.6502023935317993 -0.8552163243293762,
3Dc2c=-0.8354106545448303 0.3235208988189697 -0.44432342052459717,
3Droll=-75.5946486014902,
3Dlights=Hard,
3Drender=SolidOutline]
{\linewidth}{\linewidth}{image3D.u3d}\\
\end{document}



The files that you will need are the following:

• The 3D image “image3D.u3d”
• The 2D image “image2D.png”
• The “movie15” package for LaTeX. Available from CTAN.

When you have your LaTeX file and the relevant files in the same directory; the only thing left is for you to run your LaTeX-command. I prefer using pdflatex since it skips the unnecessary steps of creating DVI and PostScript files with the original latex command.

pdflatex name_of_your_pdf_file


The result? A PDF file with a 3D enhanced image, if you have access to Adobe Reader. latex-3d-pdf. Is this the optimal solution? Not really, but it is a very neat solution if you have access to Adobe Reader. My quest however, for the optimal solution, continues…