Transparent surfaces in Raster3D


MATERIAL descriptions (object type 8) now include a parameter related to transparency. Material descriptions apply to subsequent objects in the render input file until an termination record (object type 9) is encountered. This means that an entire surface representation, for instance one generated by the program GRASP, can be rendered as transparent by inserting one record in front of it and another at the end. This is illustrated in example 6 of the Raster3D distribution kit.

Nothing is free, of course, and this includes transparency. I tried very hard to leave normal bread-and-butter operation of the rendering program unaffected by support for transparency. If you are actually rendering an image which contains transparent objects, however, the program may slow down by as much as a factor of 3. If your machine seems to do much worse than this, you can try the fix described at the end of this section.

Here is an example of a MATERIAL description which specifies a transparent surface:

    17.0    0.6     -1.0 -1.0 -1.0     0.9        0 0 0 0

    ^       ^       ^    ^    ^        ^          ^
    |       |       |    |    |        |          |
    MPHONG  MSPEC   SR   SG   SB       CLRITY     OPTS
The first record specifies a MATERIAL description (object type 8). The following record contains a set of parameters which apply to this material.
overrides the global Phong parameter in the header; a lower value (<20.) smears out specular highlights over a larger area, which is probably a good idea for transparent surfaces.
overrides the global SPECLR parameter in the header; controls what fraction of the total shading is due to specular reflection. This probably should be >0.5 for a transparent object.
red, green, and blue components of the specular highlights. Remember that each object has an associated RGB triple that determines its colour. But the "colour" of a transparent object is somewhat problematic, so you have the option of passing the object's basic colour through to appear also in the specular highlighting. This is indicated by setting SR, SG, SB negative as in the example above.
This is a value between 0.0 and 1.0 indicating the degree of clarity of the material. 0 indicates a completely opaque surface, while 1 indicates a completely transparent surface. Values in the range of 0.8 to 1.0 are probably appropriate.
These four parameters are reserved for future expansion of the MATERIAL specification. OPTS[1] controls how overlapping transparent objects are treated.
OPTS[1] = 0
All transparent objects will be rendered, subject to the limit that at a depth of three overlapping transparent objects the third is effectively opaque
OPTS[1] = 1
Only the topmost surface of any given transparent material will be rendered at all. This will, for example, cause internal cavities to disappear from a molecular surface covering an entire protein. It also allows rendering only the outside surface of a transparent CPK model.
OPTS[1] = 2
The rear-facing portions of transparent spheres, cylinders, and tesselated surfaces will be rendered (normally only the front surfaces are rendered).
OPTS[2] controls which algorithm is used to vary transparency as a function of alpha (=CLRITY) and the Z component of the surface normal. OPTS[2] = 2 is theoretically more correct, but in my opinion comes out looking less transparent than it should. OPTS[2] = 0 is an empirical function that looks better to me.
OPTS[2] = 0
T(ZN) = 0.25 * (1 + cos(pi*alpha*ZN))^2
OPTS[2] = 1
T(ZN) = (1 - abs(alpha*ZN))^2
OPTS[2] = 2
T(ZN) = 1 - alpha ^ (sqrt(pi/4) / abs(ZN))
OPTS[2] = 3
T(ZN) = 1 - alpha

Back to top Raster3D homepage
Ethan A Merritt / / Biomolecular Structure Center at UW