This project uses coordinates from small molecule structure files and
and renders them with some animation using metaballs and basic environment
mapping for a reflective surface.
Usage
The user is able to control the isovalue used to calculate isosurface, the distance each "atom" is
allowed to travel, the speed at which the atoms travel, and the denisty of the grid. In addition
the user can select between one of more provided molecules. All selected molecules will be rendered.
Decreasing the isovalue will increase the radius each atom contributes to the over all surface.
At initialization, each atom is assigned a random vector, and a speed of travel. Each iteration of the
program's main loop moves the atoms along their trajectory and recalculates the resulting surface. If an
atom reaches its maximum allowed distance, its vector is reversed and it continues in the opposite direction.
Resistance: speed of atoms, lower resistance = faster movement
Radius of Travel: controls the distance atoms may travel
Grid Increment: controls the step size of each cube during the marching cubes calculation
Code and References
The majority of this project consisted of two parts: metaball rendering and environment mapping.
Metaballs were rendered using the marching cubes algorithm. And environment mapping was done by rendering
six faces of a cube with image textuers, and using reflection vectors to find the point on the cube that it
points to.
metaball rendering based significantly off code from Nicholas at http://philogb.github.io/blog/2010/12/10/animating-isosurfaces-with-webgl-and-workers/