An Introduction to Blobby Modeler: What it is, what it does, and some theoretical foundation on how it came to be.
Goals I hope to achieve in the development of this software.
Design methodologies and implementation stages.
Installing and using Blobby Modeler
Conclusion and a summary of features accomplished, and perhaps some future directions.
References to some relevant publications.
"Established geometric modeling techniques exist to handle most engineering components, including `free form' shapes such as car bodies and telephones. More recently, there has been a lot of interest in modeling natural phenomena such as smoke, clouds, mountains, and coastlines where the shapes are described stochastically, or as fractals. None of these techniques lends itself to the description of soft objects. This class of objects includes fabrics, cushions, living forms, mud, and water."As early as 1982, James Blinn began exploring methods to model molecular structures, which was often done with ball-and-stick or space-filling-sphere models. In the interest of both artistic variety and scientific accuracy, a new model that can appear more like a real electron density cloud for a covalent bond.
The conventional approaches to model such a shape via the familiar bicubic
or quadric surfaces is difficult for elaborate molecules. For this reason,
we seek to simulate an actual electron map with quantum mechanic representation
of atoms as a density function of the spatial location. For example, a
hydrogen atom might be represented as:
Years later, Wyvill, McPheeters, and Wyvill decided to apply the technique more generally to the modeling of soft objects, which are traditionally awkward at best to render. They presented a modification to Blinn's exponential function with one which is computationally cheaper. Additionally, their function has the desirable quality of being able to ignore an atom which is too far from the point in question. They first defined a bicubic function:
IBM DataExplorer (DX) provides primitive modules that can be used to create blobby models. However, since the creation of the model involves the placement of many atoms, manual design ceases to be a good option quickly. The Blobby Modeler was designed to ease the task of the creation of models, as well as compute the resulting density field off-line to prevent overloading DX.
Blobby Modeler was written in C and Tcl/Tk in the spring semester of 1995 as partial fulfillment of requirements toward CS 790 (Master of Engineering Project) under the supervision of Dr. Bruce Land, Cornell University Department of Computer Science.
By virtue of proximity, Blobby Modeler was written on a SunOS platform, specifically one running SunOS 4.1.1. The target platform would ideally be any platform that DX would support. Though I have not been able to test over many operating systems and versions, I'm fairly confident that the code should port quite easily.
To facilitate the development of the user interface, I selected the Tcl/Tk Toolkit versions 7.3 and 3.6, respectively. Since this is an interpreted language and offers only a complicated link to C, I also selected an add-on called Embedded Tk (ET) version 1.1 by D. Richard Hipp (drh@world.std.com). Tcl/Tk is available at various sites including ftp.cs.berkeley.edu, ftp.x.org among others. ET is available at ftp.std.com.
Roughly speaking, I divided the tasks among Tcl/Tk and C by writing in Tcl/Tk code that isn't very CPU intensive. The C portion turned out to include only the functions that generate the field (including a horrible quadruple-nested loop) and those that manage the free window (which implement the 3-D transforms and 2-D projections).
In the C portion, a notable feature is the liberal use of global variables to store partial results. This is done to improve performance by reducing redundant recomputations. Most values involving trigonometric functions are cached in these variables, and recomputed only as necessary. All in all, the C fragments are simple and straightforward, composing only some one-fourth of the total number of lines of code.
The Tcl/Tk portion of the software handles most of the user-machine interactions, handling drawing, selecting, windows, refreshes, and others. About three-fourths of the program is involved here. Since this was my first Tcl/Tk program, it's performance can likely be improved by rewriting some routines.
The help text is worth mentioning, though. I implemented a small widget in Tcl that can display a very small subset of HTML. There are subtle differences between my implementation and HTML. Unlike HTML, carriage returns are significant in the help text; nested formats don't work; and formats cannot span different lines. Despite that, conversion between the two formats should not be difficult.
Aside from spherical atoms, it will also be interesting to incorporate atoms of other shapes to aid in the construction of the scene. Cubes will certainly be easy to work with, for instance.
The free window can of course be vastly improved to include its own renderer. It will prevent the small trouble of having to go over the DX in order to render the scene.
Despite the possibilities, this project has achieved its goal of providing a fast, easy-to-use interface for the designer of 3-D blobby models. It is my hope that actual users will determine the usefulness of the program.