Raycast Fragment Shader

This page describes a method of directly rendering non-polygonal objects on graphics hardware using vertex and fragment programs. This technique can render exact spheres, cylinders, ellipsoids, cones, and other quadric surfaces. It can also render window slats and other repetitive structures.

If you're rendering molecular structures, this may be just what you're looking for.

The first image below shows a polygonal representation of spheres that runs as fast as the second image (on particular hardware described in the paper below), which is a spherical representation. Click on the pictures to get larger images. See the paper for using ellipses, cones, window slats, and other more general geometry.

A PDF file describing the technique in detail is available here.

Source code and compiled examples for Windows are available here. Run the SpeedTest_poly_dlist.exe program and SpeedTest_Cg.exe programs to compare the two, although on modern cards they will both basically run at maximum frame rate. Using the DOS prompt or Cygwin, you can run the Release/Rocket.exe to see examples using other than spheres, and using textures. I haven't tried building this in several years, so you may have to update the Cg libraries to make it work.

IP status: UNC Chapel Hill filed a provisional patent on this technology and then abandoned the claim without filing a full patent, so it should be wide open and (one would think) unpatentable.