Generating a “3D” Image from One Continuous 2D Curve
Year: 2014 Authors: Mayer D. Schwartz
Core claim
Placing consistently shaped, partially opaque plates along a continuous 2D curve can generate a convincing “3D” image, especially after contrast adjustment and Möbius-based shaping.
Topics
parametric curves, 3D illusion, conformal mapping, opacity layering, digital image generation
Domains
calculus, differential geometry, numerical integration, complex analysis, generative art, visual design, digital composition, image shading
Methods
Mathematica experimentation, Simpson’s rule, plate overlap layering, Möbius transformation, contrast curve
Media
2D parametric curves, hexagonal plates, RGB color, opacity, digital images
Paper text
The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.
Proceedings of Bridges 2014: Mathematics, Music, Art, Architecture, Culture
Generating a “3D” Image from One Continuous 2D Curve
Mayer D. Schwartz 10260 SW Melnore St., Portland, OR 97225, USA mayer@aracnet.com
Abstract
An image which looks very three dimensional can be generated by a single two dimensional continuous curve. The curve serves as a guide for a series of plates which are placed at a constant distance apart along the curve. All of the plates have the same shape but each plate has its own color and opacity. The net effect can be color and shading changes within the 2D image which strongly suggests a 3D image but one that may not be physically realizable. To further enhance the 3D quality of the final image, a contrast curve may be applied to the 2D image. Often a more aesthetically pleasing final image can be obtained by applying a conformal map to the 2D image as well.
I have long enjoyed looking at harmonographs; they were the initial inspiration for this work. Originally, harmonographs were generated by swinging coupled pendulums with an attached pen for generating images. Hugh Blackburn, a professor of mathematics at the University of Glasgow from 1849-1879 invented a pendulum with a double suspension, later known as the Blackburn Pendulum, to demonstrate harmonic motion. This was most likely the first mechanical mechanism capable of generating harmonographs [5, p. 246]. The curves which are generated by a double suspension harmonograph can be described by the following parametric equations where the terms represent the frictional decay inherent in any mechanical assemblage:
An interactive simulation of these equations may be found at [2].
Parametric Curves. I wanted to explore curves beyond those as defined by equations (1) that simulate physical behavior, to a more unconstrained set of continuous parametric curves. Using Mathematica it was easy to experiment with a broad range of parametric curves; the following set of parametric equations proved capable of generating a wide variety of interesting curves:
for . Examples of curves generated from equations (2) are shown Fig. 1; for all of the curves, , and the values for the various parameters (except for ) in equations (2) are:
Just slightly varying the value for parameter gives the three apparently unrelated images shown in Fig. 1.
Placing Plates. In order to give body and texture to any of the curves generated by equations (2) (or similar parametric equations), I decided to a lay down a sequence of plates along the path taken by a curve. A plate is a two dimensional (convex) shape whose interior has a given color and opacity and which is outlined by a different color and opacity. All of the plates used for a given image have the same shape. Each plate has two apexes — these are the bottom-most and top-most (center) point of each plate. The plate apexes are placed on the parametric curve such that the bottom apex of one plate is coincident with the top apex of the previous plate and thus the orientation of the plate sides is approximately parallel to a tangent to the curve. So far, for all of the images I have generated, I have used plates, which while hexagonal, are very close to rectangular; their exact shape is defined by the ratio of their width to their height. The hexagonal shape results in slightly
Schwartz
Figure 1: Left to right: , , and
less plate overlap at points on a parametric curve where the curvature is greater than zero. Fig. 2 shows examples of plate usage from several much larger images. The leftmost example shows wide plates while the center example shows plates slightly higher than wider. The rightmost example is discussed below. As will be shown, it is the use of plates which turn a 2D curve into a “3D” looking image. In practice, there are typically anywhere from ten thousand to forty thousand individual plates used in any single image.
Figure 2: Examples of Hexagonal Plates
The curves defined in equation (2) are continuous, so that the length from any point, , on the curve to any other point, , on the curve is given by the integral [1]
The bottom (and top) apexes are placed at a constant distance along the curve from the previous bottom (and top) plate apexes. Placing the plates thus requires evaluating a function which maps a given length along the curve from the point to the corresponding value of . Based on equation (3), a table is calculated with entries for where , and . Numerical integration using Simpson’s rule [3, p. 316] is performed in order to calculate the values and interpolation is used with the table to find the corresponding value of for a given value of where .
In most cases, the curvature of the curve within a single plate is approximately constant. However, the rightmost example of Fig. 2 demonstrates what happens when the curve within a single plate has a much
446
Generating a “3D” Image from One Continuous 2D Curve
larger curvature compared with the plates on either side — the net effect is that the plate becomes noticeably smaller because its two apexes are closer together.
Coloring the Plates. While the images shown in Fig. 1 have a faintly 3D feel to them, I believe it is the combination of the shading and build up of color introduced by the partial opacities of the plates, as well as the geometry of plate overlap, as exemplified in Fig. 4, (which uses the leftmost curve of Fig. 1) that effectively realizes the 3D quality inherent in the curve. This effect was quite unexpected but very satisfying! The shading is provided by varying the color (as an RGB triple with values normalized to the range [0,1]) and varying the opacity of each plate as a function of length along the curve from its starting point . The total length of the curve, , is normalized to 1. To keep the plethora of possibilities for defining the plates (for a given curve) under control, I made the following restrictions:
- Two colors are chosen: for the first plate and the last plate. The colors of intermediate plates are derived as a weighted average of these two colors. The weights are given by a continuous, monotonic function of the normalized length from the first plate to any intermediate plate.
- Two opacities are chosen: for the first plate and the last plate. The opacities of intermediate plates are derived as a weighted average of these two opacities. The weights are given by a continuous, monotonic function of the normalized length from the first plate to any intermediate plate. The opacity weight function is independent from the color weight function.
- The weight functions are all of the form for some \alpha > 0 . Note that .
- The length along the curve between any two successive top or bottom apexes is a constant and the ratio of the width to the height of any plate is a constant.
These restrictions still allow for a very wide range of possibilities. Choosing the first and last plate colors is probably the most difficult artistic decision to make. This difficulty is increased because no plate is placed with opacity equal to 1 (totally opaqueness) and a color contrast curve (described below) is added to most images.
Figure 3: Conformal mapping by Möbius transformation with
Shaping by Conformal Mapping. For most images, the 2D image (with its corresponding apparent 3D image) is formed into a more “pleasing” shape by applying a conformal (angle-preserving) map in the complex plane corresponding to the 2D image. The entire 2D image is linearly mapped to the complex region where and are the real and imaginary parts respectively of . A Möbius transformation of the form , where is the complex conjugate of , is
Schwartz
used as a conformal map from to . Fig. 3 shows an example of the resulting region for a value of .
Contrast Curve. A contrast curve (analogous to a Curves Layer in Adobe Photoshop) is frequently added to increase contrast, particularly if low opacities are used in coloring plates. A contrast curve is a function, from normalized RGB values to normalized RGB values. Almost always, is continuous and monotonic in each of its arguments, , and . Using a contrast curve can frequently enhance the 3D quality of an image.
Final Results. The leftmost image of Fig. 4 shows the leftmost image of Fig. 1 after placing and coloring plates. The rightmost image of Fig. 4 shows the final image after shaping by a Möbius transformation with , rotation by 185 degrees, and the application of a contrast curve.
Figure 4: Left: before shaping and application of contrast curve. Right: final image.
References
[1] Christian Bär, Elementary Differential Geometry, Cambridge University Press, 2010. [2] Michael Croucher, “Simulating Harmonographs”, from the Wolfram Demonstrations Project, http://www.demonstrations.wolfram.com/SimulatingHarmonographs/ (as of April 2014). [3] Eugene Isaacson and Herbert B. Keller, Analysis of Numerical Methods, Wiley, 1966. [4] Tristam Needham, Visual Complex Analysis, Oxford University Press, 1997. [5] Clifford A. Pickover, The Math Book, Sterling, 2009.