POV-Ray: A Tool for Creating Engaging Visualisation of GeometryWritten by Paul BourkeJanuary 2004 Abstract Computers are now a standard tool for creating, exploring, and presenting geometric form and mathematics. Finding the right software tools can be difficult, especially so when high quality and visually appealing images are required. This paper will discuss one particular package (POV-Ray) used with great success by the author. A general discussion of the desirable features will be presented along with examples based around the familiar tetrahedral form. IntroductionThe mathematician and geometer often needs to represent equations or geometry visually, both for their own insight (visualisation) and as a way of conveying information to a wider audience. There are a number of software packages that have been designed to meet this need but most concentrate on the former goal and as such may be able to create informative images for the expert but tend to be limited in their ability to create higher quality images that may be more informative and attractive to a general audience. There are a number of consideration when choosing software for any task and there are some others that are relevant to the presentation of geometry.
The software package to be discussed here, POV-Ray, goes some way to meeting all the above. It is free and runs identically on all major operating systems and computer platforms. It has a very powerful language for describing geometry which includes a programming language and it is straightforward to create geometric descriptions with external software. The method by which it renders the geometry is based upon a technique called ray tracing, as such it is capable of very high quality imagery with a high degree of realism. Ray TracingRendering software such a POV-Ray creates an image using a technique known as a ray tracing which broadly means it takes a description of geometry (which includes surface materials and light sources), a model of a virtual camera, and a projection plane made up of the pixels in the final image. It then creates what the camera would "see" by shooting rays from the camera through each pixel and analysing how they are affected by the geometry, materials, and lights. An interesting consequence of the ray tracing technique is that traditional computer graphic primitives such as ideal points and lines cannot be represented, indeed in most cases a ray tracer does not even have those as geometric building blocks. The reason is that a ray will never strike a point or a line (they have no thickness) and could therefore never be made visible, in a similar way that a true line could not be seen by ourselves because it would not reflect any light. A ray tracer generally has a polygon primitive (bounded region of a plane that is infinitely thin) however it would suffer the same fate if viewed exactly edge on. ExamplesThis section will illustrate the capabilities of POV-Ray to create geometry with some concrete examples. In each case the core geometric description will be given along with the resulting image. Please note that this is not intended to be a tutorial on POV-Ray or the scripting language but more to give a sense of the elegance and power of the description. For tutorials, documentation, and reference material the POV-Ray web site (http://www.povray.org/) should be consulted. 1. Simple geometric building blocksThe lack of line and point primitives with which to build a computer based model may seem rather restrictive. As it turns out the model is created much like it would be in real life, namely with materials of finite thickness such as wire, straws, balsa wood, and balls of putty. The computer versions of these are spheres and cylinders, they both have an associated radius. For the first example, see figure 1, the geometry description that created this tetrahedron is made up of 4 vertices (copper spheres), 6 edges (silver cylinders), and 4 faces (blue, transparent glass). One of each of these appears in the geometry file as follows.
Note that the exact formatting is not important and that names such as "sphereradius", "copper" are not shown but would be defined earlier in the scene file. The full POV-Ray scene files that were used to create the images here are provided at the end of this document. Figure 1. Tetrahedron constructed using cylinders, spheres, and semi transparent and reflective glass
A more interesting geometric primitive is a parametric surface, to illustrate this consider the following code which describes the "Steiner Look-a-Like" surface and generates the image in figure 2.
Most of the meaning can be guessed at, the first three lines are the equations in (u,v) for each coordinate axis, the fourth line specifies the (u,v) range, the subsequent lines relate to how the internal algorithm functions. The example here is a Steiner Look-A-Like (Roger Bagula) surface defined by three parametric equations of two variables. Figure 2. Steiner Look-A-Like surface (Roger Bagula) 3. Isosurfaces When an implicit equation in known then that can be explored by using the isosurface primitive. the example here is a tetrahedron Kusner-Schmitt surface.
Figure 3. Kusner-Schmitt surface described an an isosurface of an implicit function
Solid constructive geometry (often simple called CSG) is a very powerful method for constructing forms that are the union, intersection, or difference of simpler solids. In the following example it is used to create the intersection of multiple cylinders, in much the same way in which the Steinmetz solid is the intersection of two circular cylinders at right angles to each other, we consider here the intersection volume of 4 cylinders. Each cylinder is along the line that passes through each vertex of a tetrahedron and the center of the opposite face.
Figure 4a. Cylinder intersection, tetrahedral arrangement
Figure 4b. Cylinder intersection, result
The great advantage of a programming language is that geometry may be algorithmically constructed, this is illustrated in figure 5 for the 3D version of the Sierpinski gasket. A tetrahedral element is constructed and repeatedly scales and translated for as many iterations as required. This is a relatively simple example using CSG and iterative declarations, the POV-Ray language also supports loops, logical decisions, variables, etc.
Figure 5. Tetrahedral fractal (6 iterations)
The goal here has been to suggest that POV-Ray, a free and cross platform rendering package, has powerful features making it a useful tool-kit for the mathematician and geometer. The short example code pieces should hopefully not look too scary (full code given below) and encourage the reader to download the software (www.povray.org) and experiment for his/her self. ModelsThe complete POV-Ray models (Version 3.5) used to create the images in the above are given here.
|