In many hard sciences focus is on formulas and text, whereas images are mainly graphs or simplified representations of researched matters. Beautiful visualisations are mainly artist’s impressions in popular media targeting hobby-scientists. When Cyrille Favreau made the first good-working version of his real-time GPU-accelerated raytracer, he saw potential in exactly this area: beautiful, realistic visualisations to be used in serious science. This resulted in software called IPV.
He chose to focus on rendering molecules of proteins and this article discusses raytracing in molecular sciences, while highlighting the features of the software.
This project has been discussed on GPU Science, but this article looks at the the software from a slightly different perspective. If you don’t want to know how the software works and what it can do, scroll down for a download-link.
Raytracing is a quite old technique to render photorealistic images of models. The idea behind it is taken from nature: a light-source produces an unlimited number of light-waves in all directions, which can piece-wise be followed while they bounce on objects, get partly absorbed by coloured surfaces, go through transparent materials, and end in an eye or camera where they get absorbed and observed.
There are two main techniques. One follows the light-waves from all the light-sources bouncing through the scene, and the second does the reverse and starts at the camera. The number of rays defines the observed resolution of the image.
Raytracing is fairly simple and follow these steps only:[list3]
- Choose new direction based on rules.
- Find border.
- Compute the new angle and split the ray if necessary.
- Apply rules given the ray-characteristics and border.
If the ray hits a light-source it will get that value, else it will get the value of the global diffuse light.
Besides rendering images, the technique can be used for many other applications. Think of the experiments at CERN, tomography, the amount of light received by on object, labyrinth-solving, etc. Maybe the labyrinth-solving was unexpected, but it follows the rules perfectly.
Recent developments have made it possible to do raytracing on GPUs, resulting in extremely fast rendering and (depending on the complexity of the scene) with high enough frame-rates to make it usable for real-time rendering while walking through the scene.
A GPU has many cores which independently can follow a ray. The first method is less fit for the GPU, as many light-waves end up in the same pixel and thus adding colour to the same memory-location which needs to be sequencialised. With the second method the writing of a pixel is done by one and the same thread.
Cyrille’s raytracer is the first real-time raytracer of molecules. The goal is to give scientists a visual tool to better explore proteins, and to help students to better understand the molecules they need to study. IPV will be extended to be the perfect tool to do visual experiments, like combining two molecules or adding acids and enzymes.
As the molecular construction itself is not the compute-intensive part of the rendering, there is a lot of flexibility to extend IPV in many ways to alter this construction.
Finding the exact location where a ray hits an object is an expensive operation. As it is very easy to compute if a ray does not enter a cube, thousands of objects can be handled.
Finding optimal box-sizes is one of the challenges, as this has large influence on the performance. In IPV the boxes can be shown (image at the right) and the chosen number of boxes can be manually overruled.
Complex molecules as shown below can be rendered at fairly high frame-rate.
Refractions and reflections
Reflections are the power of raytracing. They make the image look realistic. Each time a ray bounces at an object, this alters the colour as received by the camera. The result is an
Refractions happen when a ray enters a transparent object. One ray bounces on the surface and one ray enters the material under an angle defined by the material. This results in both reflections and realistic bending of the light by the object.
Especially refractions are very hard to do with emulating techniques, which for example compress the scenery under water.
Adjustable depth of field
The length of each ray is used to define the diffuseness (bleeding) of each pixel. This results in blurry pixels which are “out of focus”.
In IPV this can be altered to a point that the focused area is very shallow. Notice that the blurred objects are before and behind the focus-depth.
3D viewing and Anaglyph 3D
By rendering a second scene for a camera slightly moved sidewards, a 3D effect can be created. The 3D-effect that can be viewed on any PC is using the cheap red&blue glasses which come with some DVDs, called “anaglyph 3D”. Having 3D-support gives a better view of the actual
In IPV the distance between the two cameras can be altered to increase the 3D-effect.
Natural User Interfaces
When interacting with molecules, a keyboard and a mouse can feel to restrictive. Cyrille has put time in trying out the Kinect and WiiMote. Especially with two WiiMotes to control two molecules, easiness of interaction was increased.
One of the limitations of high performance software is that it restricts itself to high-end machines. In a time of tablets and laptops, other solutions are needed. IPV has support for cloud-rendering, making it possible to support several users on connected devices.
For whom is IPV?
Raytracing is the future of digital imaging and augmented reality. We are only a few months away from getting the necessary computing power to use this technique on desktop personal computer. IPV is ready for this revolution.
Being able to go much further than rasterization in terns of image quality, ray-tracing also makes it easy to compute, for example, the amount of light received by on object.
The nature of ray-tracing, and the techniques used for its implementation can be reused to execute use-cases such as computing interactions between atoms. Another use-case would be the computation of collisions between atoms. Determining in realtime what the surface of contact would be between two molecules would help understanding how they fit together. In such a use-case, NUI devices force feedback features can be used to increase quality of user experience. IPV also is ready for this.
IPV is currently unmatched on the market, as it is the only piece of software using ray-tracing for real time molecular visualization.
See for yourself
Below video shows all above features. The video was shot at an resolution of 640×480 and is a real-time recording.