Blobby Modeler

Version 1.0 May 18, 1995
Szu-Wen Huang


Acknowledgements

Anu, for lending me the Tcl/Tk book;
Asif, for giving me good ideas every now and then;
Dr. Bruce Land, for the guidance and patience;
Mom and Dad, for the money it cost to come here and so much more; and
Mabs, for making everything worthwhile.
My most heartfelt gratitude.


This document contains information relevant to the development of Blobby Modeler, including a summary of previous research leading to the actual project. Instructions on the installation and operation of the software are likewise provided.

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.


Introduction:

"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."

- Geoff Wyvill, Craig McPheeters, and Brian Wyvill 1986

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:

[1] D(x, y, z) = exp(-ar)
where r is the distance from a location to the center of the atom. If several atoms are present in the scene, the effects of their density field are simply added. Extracting a surface of constant value across the field, the molecular density cloud can be formed. Blinn named this the blobby model.

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:

[2] C(r) = 2r³/R³ - 3r²/R² + 1
where C is the intensity of influence, r is the distance between the point in question and the atom, and R is the radius of influence of the atom. An almost equivalent but more efficient version of the function is:
[3] C(r) = ar^6/R^6 + br^4/R^4 + cr²/R² + 1
where the values of a, b, and c are found by solving with the following constraints:
C(0.0) = 1.0
C(R) = 0.0
C'(0.0) = 0.0
C'(R) = 0.0
C(R/2) = 0.5
yielding:
a = -0.444444
b = 1.888889
c = -2.444444
In 1991, Shigeru Muraki took it one step further, and applied blobby models on range data to visualize very interesting objects such as human faces. Immediately obvious from his research is that to achieve a reasonable degree of realism modeling anything other than simple molecules, a blobby model should be composed of a large number (typically hundreds) of atoms.

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.


Goals:

The following are design goals of Blobby Modeler:


Designing Blobby Modeler:

A three-dimensional modeler running on a conventional computer has the difficulty of unsuitable input devices. Some attempts were made to allow for the mouse to control two of the dimensions and the keyboard the third, but I personally think that is clumsy and awkward to use. Instead, I adapted the approach taken by many personal computer graphics tools as well as graphics workstation software. I provided three editing windows, through which all degrees of freedom can be encompassed. Blobby Modeler hosts 3 editable windows fixed with the xy, yz, and xz views. In addition, it provides a free window in which a camera can be placed in 3-space and the model previewed. The rendering in the free window is simplistic and in fact, crude. However, a complicated preview window can slow down the response of the software considerably, and defeats our goal to be lean and mean.

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.


Conclusions and Future Directions:

At its present state, Blobby Modeler is a complete 3-D editing platform ready for beta-testing. Undoubtedly as it undergoes actual usage, problems will arise and enhancements will be made. Glaringly absent, however, is the ability to move the atoms in an animation. With that capability, Blobby Modeler can probably be used to model scenes such as boiling water. Animation will definitely be a desirable addition.

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.


References:

  1. J. Blinn. A Generalization of Algebraic Surface Drawing., ACM Transactions on Graphics. 1982.
  2. G. Wyvill, C. McPheeters, B. Wyvill. Data Structure for soft objects. Visual Computer. 1986
  3. G. Wyvill, C. McPheeters, B. Wyvill. Animating soft objects. Visual Computer. 1986
  4. S. Muraki. Volumetric Shape Description of Range Data using "Blobby Model". ACM SIGGRAPH. 1991.
  5. J. Ousterhout. Tcl and the Tk Toolkit. 1994.
  6. A. Watt. 3D Computer Graphics. 1993.


Last Modified: May 18, 1995
Szu-Wen (Steven) Huang