From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon May 13 2002 - 11:42:13 CDT

Todd,
  Yes, it is done purely for speed.
There are various sorting issues you have to overcome in order to use
the alpha channel method. The way VMD does its interactive rendering
loop right now gets in the way of doing the type of on-the-fly geometry
sorting that we'd need to do for best alpha channel transparency.
One could probably hack something in, but it wouldn't be quite as general
as the stipple based method. The stipple method also works on low-end
hardware, which a few thousand of our users are running presently.
We do intend to implement alpha transparency, but I'm not sure when we'll
have time, many other things are still higher in priority for VMD 1.8.

There is another issue with alpha transparency in that I have to check into
how the alpha information would propagate into the low level geometry, if
I can set a "global alpha" value, that would work well. I seem to remember
there being an OpenGL extension for this. If not, then it would penalize
our performance (and our internal graphics interface) since we'd have to
carry that information around at the per vertex level otherwise. I'll think
about it and see what's involved again. I have to admit that it has been
a few months since I last looked at doing alpha blending for transparency.

The cheesiest implementation would be to do rendering in two stages:
  1) draw all opaque representations first
  2) repeat the rendering loop a second time, using the Z-buffer from the
     first pass and then draw alpha-blended geometry on top of the
     solids that are already there.

Since VMD does material properties on a per-representation basis, we could
get good efficiency by using a "global alpha" value which automatically
overrides all vertices/colors while active. The global alpha value would
be set on entry into rendering each representation, then we draw the rep,
and continue on.

The main problem that still remains here is that if you have multiple reps
overlapping each other, unless you draw them in the correct order, things
can look quite weird. So, even with this cheesy implementation, we'd have
to introduce some sorting just to have it look half-decent while not losing
much speed.

VMD 1.[12] and earlier used to have full geometric depth-sorting implemented
in the old IRIS-GL renderer, but it was a tremendous speed hit, and the old
IRIS-GL transparency code still didn't work quite right. I made the decision
to eliminate that feature a long time ago in hopes of making the program
run much faster (which it does) and in hopes of making it run even on low-end
hardware lacking hardware alpha blending. Now the pendulum is probably
swinging back the other way, with most people getting hardware alpha blending
on their PC's within the next year or so, and then it would make sense
to have alpha blended transparency as an option, though it would still
probably be a fair amount slower than stippling. I can't really promise it
for VMD 1.8, but we'll see how it goes. :-)

  John Stone
  vmd_at_ks.uiuc.edu

On Mon, May 13, 2002 at 12:20:57PM -0400, Todd J. Furlong wrote:
> I see in the code that transparency is implemented using the "screen
> door" method with glPolygonStipple rather than using the alpha channel.
> I assume this was done because it is faster, but is there another
> reason? Maybe having the option for either method would be a desirable
> feature of VMD 1.8?
>
> -Todd
>
> John Stone wrote:
> >Hi,
> > To use the draw or graphics commands with your own materials,
> >you first need to define your material with the material editor
> >if you're not using one of the two default materials "Opaque" and
> >"Transparent". Once the materials are defined, you can use a command
> >like this to draw things with that material property (case sensitive):
> > draw material Transparent
> >
> >Or for your own material name:
> > draw material MyNeatoMaterial
> >
> >If you need to have graphics objects with different materials, then you'll
> >need to use the "graphics" commands with ID tags to differentiate which
> >one you're working on, etc. This is documented in the User's guide
> >here:
> > http://www.ks.uiuc.edu/Research/vmd/vmd-1.7.1/ug/node167.html
> >
> >The graphics/drawing interface is changing slightly for VMD 1.8, but
> >if you do your work on VMD 1.7.1 it should be easy to update later.
> >
> >Enjoy,
> > John Stone
> > vmd_at_ks.uiuc.edu
> >
> >On Fri, May 10, 2002 at 11:46:01AM -0500, tripp_at_fis.unam.mx wrote:
> >
> >>Hi L,
> >>
> >>this is a simple question, but nothing seems to work;
> >>how can I draw a transparent cylinder?
> >>
> >>I'm using VMD 1.7.1 in redhat
> >>
> >>thx
> >
> >
>
>
> --
> Todd J. Furlong
> Visualization Engineer
> Delta Search Labs
> 400 Technology Square
> Cambridge, MA 02139
> 617.551.4607
> 617.551.4651

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078