[chimera-dev] volume display with transparency
Thomas Goddard
goddard at cgl.ucsf.edu
Wed May 21 10:34:22 PDT 2003
Hi Steve,
Surprisingly just yesterday I added surface methods to control the
specular highlights on transparent models. Those changes are in C++ and
not in the Chimera 1700 release. What platform are you using Chimera on?
We might be able to make a snapshot release for you.
Here are some details of the Chimera 1700 isosurfaces. The isosurfaces
are Surface_Model objects made by the _surface.so C++ module. The C++
header file wasn't in the header files I gave you before. You can get it
from:
http://www.cgl.ucsf.edu/home/goddard/surfmodel.h
There's alot of junk in it to support automatic Python interface generation.
I also have a write-up about surface models
http://www.cgl.ucsf.edu/home/goddard/surface.html
The Chimera volume viewer uses _surface models to show isosurfaces.
That code is in __init__.py and surface.py in chimera/share/VolumeViewer.
It is pretty complex. The above surface.html is easier reading.
Here's the transparency situation. Surface_Model uses OpenGL (1,1-alpha)
blending. This means it adds the RGB color of a surface triangle plus
the transparency (=1-alpha) times the color from behind the triangle.
So making the surface more transparent doesn't dim the surface. As you
make the surface more transparent, more light comes through from hidden
triangles and the whole surface gets brighter. The more common transparency
mode is OpenGL (alpha,1-alpha) blending. It multiplies the RGB color of
the triangle (including any specular highlights) by alpha and adds
(1-alpha) times the color coming from behind the triangle. Transparent
surfaces have alpha close to zero, so they get dimmer. Chimera 1700
Surface_Model only supports the first mode, although our current development
Chimera allows you to choose the mode.
In the Volume Viewer dialog, the isosurface color has a transparency
and there is the transparency slider. They are combined so the
surface alpha = (1-transparency factor from slider) * (color alpha).
This is done by the modulated_surface_color() routine in
chimera/share/VolumeViewer/__init__.py. Alpha is the 4th component of
RGBA values and represents opacity in the range of 0 (fully
transparent) to 1 (fully opaque).
I don't know about transparency capabilities with PDB models. The
expert on that, Greg Couch (gregc at cgl.ucsf.edu), is on vacation until
Monday. If I open a PDB model, show it as ball and stick, and color
the molecule with transparency (Actions/Color/Color from editor), then
it does show the model as transparent. Transparency didn't work on
a ribbon representation. Transparency does work on molecular surfaces.
A serious problem you are likely to run into is that Chimera can only
correctly display one transparent model at a time. This is an inherent
limitation of its graphics architecture. So if you try to fade out a
PDB model and a transparent isosurface, it will not look right. The
underlying problem is that triangles from all models need to be sorted
by depth to get correct transparent rendering. Chimera can only do
the depth sort within a single model.
Tom
More information about the Chimera-dev
mailing list