Content uploaded by Emiliano Cristiani

Author content

All content in this area was uploaded by Emiliano Cristiani on Apr 07, 2015

Content may be subject to copyright.

3D PRINTERS:

A NEW CHALLENGE FOR MATHEMATICAL MODELING

Emiliano Cristiani

Istituto per le Applicazioni del Calcolo

Consiglio Nazionale delle Ricerche

Rome, Italy

Abstract. This short communication aims at creating a bridge between 3D printing

and advanced mathematical methods. We review some features of 3D printing in

order to show how 3D printers’ software can beneﬁt from mathematical methods. To

prove the feasibility of one possible PDE-based approach, we use a classical model

for the Shape-from-Shading problem to create a 3D object starting from a single 2D

photograph, and we 3D-print it!

1. New modeling needs. Is a new industrial revolution coming? Many people think

so: 3D printers are able to create almost any solid object one can image and replicate

existing ones. Nowadays, the price of a 3D printer is small enough to allow many people

to have one at home, and create their own plastic objects (works of art, toys, glasses,

covers for cell phones, spare parts of any kind, etc.). Within a decade, some products

may be downloaded from the Internet for printing at home, causing a revolution in the

market of such a small objects. One can also print at home some parts of an object and

buy the others at shops, then assemble the ﬁnal product by himself. Most important,

the number of printable materials is growing and it is already possible printing an object

mixing diﬀerent materials. We leave to futurists the comments about the time when 3D

printers will be able to fully replicate themselves.

In the context of 3D printers there exist several new modeling needs. We list some of

them which could be attacked by known mathematical techniques, like PDE-based and

variational methods.

Hardware issues. If the 3D printer employs the additive manufacturing technique

(the solid object is created through an additive processes in which successive layers of

material are laid down under computer control), 3D-printouts are not always satisfactory

due to some ﬂaws and artifacts which come out during the deposition of the material. It

can happen that the machine deposits too much material in some parts of the object, or

the material oozes, especially when the nozzle changes direction or stay on the same point

for a long time. This issue is mainly related to the temperature of the nozzle’s hot end,

to be suitably controlled, and the pressure drop due to the ﬁlament, see, e.g., [10].

3D printing without a 3D model. 3D-printed objects usually originate either by

virtual solids created on a computer or by 3D scans of real objects. In some cases, one

wants to replicate a real object which cannot be 3D-scanned, so that other techniques must

2010 Mathematics Subject Classiﬁcation. 68U10.

Key words and phrases. 3D printers, 3D printing, Shape-from-Shading, Hamilton–Jacobi equations,

PDE-based models, Variational models.

1

arXiv:1409.1714v1 [math.NA] 5 Sep 2014

2 EMILIANO CRISTIANI

be employed. The typical scenario is that of the (photometric, perspective) Shape-from-

Shading problem, see, e.g., [6,15], [3] and [12], where one or more photographs of the same

object are used to build the 3D surface corresponding to the object. The photographs are

usually taken under diﬀerent points of view or diﬀerent light conditions. By means of

these techniques one can also 3D-print objects which are physically impossible to create.

Shape or shading? 3D-printed objects replicating real objects are usually made of a

diﬀerent (and cheaper) material with respect to the original one. As a consequence, it is

expected that the replicated object reﬂects light in a diﬀerent manner (diﬀerent albedo,

diﬀerent degree of Lambertianity), thus resulting in an unsatisfactory product. In some

cases it can be preferable creating an object with diﬀerent shape but which appears as

the original one. In other words, one aims at replicating the reﬂectance properties of an

object, not its original shape. Let us mention, among others, the paper [11] which proposes

a method to generate and print a solid with custom surface reﬂectance properties. The

underlying idea is that, starting from an original object, one can modify its surface by

means of tiny ripples which modify locally the normal to the surface and, consequently,

the way the surface reﬂects the light.

Printing with diﬀerent materials. Let us also mention the possibility to print ob-

jects with diﬀerent materials simultaneously, alternating them while printing [13]. Mate-

rials can have diﬀerent reﬂectance properties and transparency, and, consequently, endless

combinations are possible, as well as related optimization processes. Similarly, one can

coat the surface with paint, thus altering the reﬂectance properties.

Shape optimization. Printing plain solids is often not convenient because of the large

quantity of material to be used [14]. Shape optimization tools can give the optimal way

to hollow the solid, keeping the desired rigidity and printable features.

A similar problem comes from the fact that some objects are not 3D-printable at all,

because they have hang parts (like a horse leaning on two legs) [14]. In this case one

should ﬁnd the minimal amount of material needed to lean the object against the base

of the printer and/or ﬁnd a suitable coordinate system in which the object can lie in

equilibrium without falling down during the printing process. Moreover, one could need

to insert artiﬁcial chamfers in the solid to reduce too large slopes.

A new economy. 3D printers are going to make a revolution in some basic laws of

economics. First of all, for 3D printers, it does not matter how many items are produced.

The price of production per item remains constant. Then, production on the small-scale

is eﬃcient as large scale production. Second, complexity is no longer an issue because the

rule “the more complex an object is, the more money must be spent on robots and people

to build it” is no longer true. We expect that new models for mathematical economics

could be developed to describe these new kind of manufacturing features.

The goal of this short communication is creating a bridge between 3D printing and

advanced mathematical tools, in particular PDE-based models. Indeed, although the

literature about 3D printers is already large, dedicate advanced mathematical tools are

still missing. To our knowledge, no PDE-based or variational models were proposed so far.

As a very ﬁrst attempt, we will focus on the problem of getting a 3D model of a real object

without a 3D scan of it, aiming at creating a solid which appears, without necessarily being,

as the original one. To do that, we use the PDE-based machinery already developed for

the Shape-from-Shading problem [6,15]. Our results can be compared with those in [1,2],

where authors propose discrete optimization methods to get a 3D object starting from a

2D image of it, in such a way that the object appears as the input image when illuminated

under prescribed light conditions.

3D PRINTERS: A NEW CHALLENGE FOR MATHEMATICAL MODELING 3

2. Shape-from-Shading. In this section we brieﬂy recall the Shape-from-Shading (SfS)

problem and a classical PDE-based model used for solving it.

SfS is a well-known ill-posed problem in computer vision [8,9]. It consists in recon-

structing the 3D shape of a scene from the brightness variation (shading) in a grey level

photograph of that scene.

The study of the SfS problem was a hot topic for many years, and a huge number of pa-

pers have appeared on this subject, especially from the computer vision and mathematical

community. We refer the interested reader to the surveys [6,15] and references therein.

To introduce the model, let Ω be a bounded set of R2and z: Ω →Rbe the (visible)

surface of the 3D object we want to reconstruct. The PDE related to the SfS model can

be derived by the image irradiance equation

R(ˆn(x, y)) = I(x, y),(x, y )∈Ω,(1)

where Iis the brightness function measured at all points (x, y) in the image, Ris the

reﬂectance function giving the value of the light reﬂection on the surface as a function

of its orientation (i.e. of its normal) and ˆn(x) is the unit normal to the surface at point

(x, y, z(x, y)). If the surface is smooth we have

ˆn(x, y) = (−zx(x, y),−zy(x, y),1)

p1 + |∇z(x, y)|2.(2)

The brightness function Iis the datum in the model and it is measured on each pixel of

the image in terms of a gray level, for example from 0=black to 1=white.

In order to make the problem manageable, a set of assumptions about the surface and

the camera used to take its photograph are usually considered: (H1) The material is

Labertian (its brighness does not depend on the observation point) and the albedo (the

ratio between the energy reﬂected and the energy captured) is constant; (H2) The light

source is unique; (H3) Both the light source and the camera are very far from the surface

(ray lights are parallel, no perspective deformations are visible); (H4) Multiple reﬂections

are negligible; (H5) The surface is completely visible by the camera, i.e. there are not

hidden regions (undercuts).

Under assumptions (H1)–(H5), we have R(ˆn(x, y)) = ω·ˆn(x, y),where ω∈R3is a unit

vector which indicates the direction of the light source. Then, equation (1) can be written,

using (2), as

I(x, y)p1 + |∇z(x, y)|2+ (ω1, ω2)· ∇z(x, y )−ω3= 0 ,(x, y)∈Ω,(3)

thus getting a ﬁrst order nonlinear PDE of Hamilton–Jacobi type. If the light source is

vertical, i.e. ω= (0,0,1), equation (3) simpliﬁes to the eikonal equation, see, e.g., [6].

3. 3D-printed Lena. We employed the PDE model based on equation (3) to recon-

struct a 3D virtual representation of Lena (the most celebrated example for benchmarks

in computer vision and image processing), starting from a single photograph (Fig.1(a)).

We assume here ω= (0,0,1), i.e. vertical illumination. The domain Ω is discretized by a

structured (rectangular) grid with 401×401 nodes, corresponding to the pixels of the orig-

inal image. To discretize the equation we used a ﬁrst-order semi-Lagrangian scheme [7],

which is iterated at each grid node until convergence is reached. Boundary conditions are

z≡0 for (x, y)∈∂Ω. The reconstructed surface is (an approximation of) the unique vis-

cosity solution to the equation, which of course does not match the real shape (Fig.1(c,d)).

Nevertheless, the simulated photograph of the surface taken under assumptions (H1)–(H5)

gives Lena back (Fig.1(b)), cf. [5,6].

4 EMILIANO CRISTIANI

(a) (b)

(c) (d)

Figure 1. SfS on Lena. (a) Original image, (b) Simulated photograph of

the reconstructed surface, (c) Reconstructed surface (front), (d) Recon-

structed surface (rear).

Before printing the surface, we resampled the square grid in a triangular mesh by di-

viding each cell in two triangles tracing the diagonal, and we created a solid object (see

Appendix for details). The solid was printed using the printer DELTA 20 40, with resolu-

tion 0.012 mm on x,yand 0.2 mm on z. The material is PLA (white). Physical dimensions

are 120×120×109 mm. 3D-printing time was about 4 hours. The result is shown in Fig.

2(a), whereas Fig. 2(b) shows a photograph of the solid under a vertical illumination,

obtained by means of a built-in ﬂash. We note that Lena is perfectly recognizable in any

light condition, provided that the viewpoint is vertical.

Conclusions and perspectives. The result of this short communication shows that 3D

printing can actually beneﬁt from advanced mathematical models and methods. Indeed,

despite the authors of [4] claim that modern methods for SfS “fail to ﬁt the shading details

and thus cannot reproduce detailed normal variations over the surface”, we obtained a solid

which ﬁts well the expected features. It is also useful to note that it is often preferable to

handle surfaces with small height variation, due to manufacturing constraints. This can

be achieved by duly selecting one of the many weak solutions of the SfS PDE, rather than

the unique viscosity solution as we did here.

Acknowledgments. The author wishes to thank Simone Cacace, Maurizio Falcone and

Fabio Bonaccorso for the fruitful discussions he had with them during the preparation of

this short communication. He also wishes to thank 3DiTALY for the hardware support.

3D PRINTERS: A NEW CHALLENGE FOR MATHEMATICAL MODELING 5

(a) (b)

Figure 2. 3D-printout. (a) Real photograph of the solid object under

sunlight, (b) Real photograph of the solid from above, illuminated by a

ﬂash.

Appendix A. The STL format. STL (STereo Lithography interface format or Stan-

dard Triangulation Language) is the most common ﬁle format used by 3D printers to

store object data which have to be printed. It comes in two ﬂavors, ASCII or binary. The

latter requires less space to be stored and it can be easily created from the former via free

software, e.g., STLView.

3D printers can create solid objects. The object is determined by means of its surface,

which must be closed, so to have a watertight object. This means that, e.g., a plane

cannot be printed and one should consider a thin parallelepiped instead. Analogously, a

sphere should be fattened in a thin spherical shell. It is also mandatory that the “interior”

and the “exterior” of the solid are always deﬁned. The simplest way to print a surface

represented by the graph of a function z=z(x, y) is placing the surface over a support

base, see Fig. 3, in order to close the graph and form a solid.

Figure 3. Example of triangulated pyramid “closed” by a thin parallelepiped.

6 EMILIANO CRISTIANI

The surface of the solid to be printed must be tassellated by means of a triangulation.

Each triangle, commonly called facet, is uniquely identiﬁed by the (x, y, z) coordinates

of the three vertices (V1, V2, V3) and by its unit exterior normal (ˆnx,ˆny,ˆnz). The total

number of data for each facet is 12. Moreover,

1. Each triangle must share two vertices with every neighboring triangle. In other

words, a vertex of one triangle cannot lie on the side of another triangle.

2. All vertex coordinates must be strictly positive numbers. The STL ﬁle format does

not contain any scale information, the coordinates are in arbitrary units. Actual

units (mm, cm, ...) will be chosen in the printing process.

3. Each facet is part of the boundary between the interior and the exterior of the object.

The orientation of the facets is speciﬁed redundantly in two ways. First, the direction

of the normal is outward. Second, the vertices are listed in counterclockwise order

when looking at the object from the outside (right-hand rule).

The actual format of the STL ﬁle is given in the following.

s ol i d n a me - of - th e - s o l id

facet n orm a l n x n y n z

outer lo o p

vert e x V 1 x V 1 y V 1 z

vert e x V 2 x V 2 y V 2 z

vert e x V 3 x V 3 y V 3 z

endloop

endfacet

facet n orm a l n x n y n z

outer lo o p

vert e x V 1 x V 1 y V 1 z

vert e x V 2 x V 2 y V 2 z

vert e x V 3 x V 3 y V 3 z

endloop

endfacet

[...]

e nd s o l id n am e - o f - t he - s o li d

Values are ﬂoat numbers and indentation is made by two blanks (no tab). Unit normal

direction can be simply computed by

ˆn=(V2−V1)×(V3−V2)

|(V2−V1)×(V3−V2)|.

REFERENCES

[1] M. Alexa and W. Matusik, Reliefs as images, ACM Trans. Graph.,29 (2010), 60:1–60:7.

[2] A. Bermano, I. Baran, M. Alexa and W. Matusk, Shadowpix: multiple images from self shadowing,

Comp. Graph. Forum,31 (2012), 593–602.

[3] M. Breuß, E. Cristiani, J.-D. Durou, M. Falcone and O. Vogel, Perspective Shape from Shading:

ambiguity analysis and numerical approximations, SIAM J. Imaging Sciences,5(2012), 311–342.

[4] Y. Dong, X. Tong, F. Pellacini and B. Guo, Appgen: interactive material modeling from a single

image, ACM Trans. Graph.,30 (2011), 146:1–146:10.

[5] J.-D. Durou, Shape from shading – eclairages, r´eﬂexions et perspectives, HDR, 2007, In French.

[6] J.-D. Durou, M. Falcone and M. Sagona, Numerical methods for shape-from-shading: a new survey

with benchmarks, Comput. Vis. Image Underst.,109 (2008), 22–43.

3D PRINTERS: A NEW CHALLENGE FOR MATHEMATICAL MODELING 7

[7] M. Falcone and R. Ferretti, Semi-Lagrangian approximation schemes for linear and Hamilton-Jacobi

equations, SIAM, 2014.

[8] B. K. P. Horn, Shape from Shading: a method for obtaining the shape of a smooth opaque object from

one view, PhD thesis, Department of Electrical Engineering and Computer Science, Massachusetts

Institute of Technology, Cambridge, Massachusetts, USA, 1970.

[9] B. K. P. Horn and M. J. Brooks (eds.), Shape from Shading, MIT Press, Cambridge, MA, USA, 1989.

[10] B. Kubicek, Improved oozing compensation for diy fused deposition 3d printers, URL http:

//kariert.org/advanceV2.pdf, Unﬁnished preprint.

[11] Y. Lan, Y. Dong, F. Pellacini and X. Tong, Bi-scale appearance fabrication, ACM Trans. Graph.,32

(2013), 145:1–145:12.

[12] R. Mecca and M. Falcone, Uniqueness and approximation of a photometric Shape-from-Shading

model, SIAM J. Imaging Sciences,6(2013), 616–659.

[13] K. Vidimˇce, S.-P. Wang, J. Ragan-Kelley and W. Matusik, Openfab: a programmable pipeline for

multi-material fabrication, ACM Trans. Graph.,32 (2013), 136:1–136:12.

[14] W. Wang, T. Y. Wang, Z. Yang, L. Liu, X. Tong, W. Tong, J. Deng, F. Chen and X. Liu, Cost-eﬀective

printing of 3d objects with skin-frame structures, ACM Trans. Graph.,32 (2013), 177:1–177:10.

[15] R. Zhang, P.-S. Tsai, J. Cryer and M. Shah, Shape-from-shading: a survey, IEEE Transactions on

Pattern Analysis and Machine Intelligence,21 (1999), 690–706.

E-mail address:e.cristiani@iac.cnr.it