visvu-2025-hermosilla-et-al-2018-kain-kovacs

Members

Overview

This project aims to build a visualization for molecules using insights from the paper Improving Perception of Molecular Surface Visualizations by Incorporating Translucency Effects, from the year 2018 by Hermosilla et al. This paper aims to improve the understanding of molecule visualizations by incorporating various effects from computer graphics, such as subsurface scattering and reflections.

Technology

The project was developed in C++ and Vulkan. For the windowing system (surface) and input GLFW was used, for enabling interactivity we used ImGUI. We also used GLM for math and structures on the CPU. To load and parse mmCIF files we used gemmi. For the config file json is used (nlohmann).

Implementation

To produce a render we first run a compute shader that computes an SDF 3D texture for the atom positions. This only needs to be done once, as long as the atom positions do not change.

For the structure we use instanced rendering, where we transform the vertices of spheres and cylinders to the atom positions. Additionally to a translation, the cylinders, which represent bonds, need to be rotated and scaled so that they connect the two spheres (atoms).

For the surface we use a ray marcher that knows the distance to the atoms from the SDF texture we generated earlier. For graphical effects that improve the understanding of the visualization, we implemented the subsurface scattering algorithm proposed by our chosen paper, which improves the structural perception significantly.

As a short summary, when the SDF texture is hit, we go in the direction of the viewing ray one more time by a customizable step (Depth in ImGui). There, we evaluate the SDF one more time and apply the formula from the paper to get a result that we add to the color.

Data

The project was tested with three mmCIF files from the Protein Data Bank (pdb):

Additional data should work in theory if downloaded in the mmCIF format from the pdb. The CIFParser we wrote works if the following fields are present:

Furthermore, more complex molecules use the "_atom_site" field for positions. We also support that, although the file does not have to have the field, if it encodes the position in the "_chem_comp_atom" field (like IBP.cif).

The filename for the data can be set in the nbl.json file, if present in the Resources/CIFFiles/ directory.

Build

Clone the repository recursively with **git clone --recursive "url/to/repository"** to also get the necessary submodules. After that, run cmake . and it should generate the project files, where you can build the project and run it. Keep in mind the nbl.json file that lets you tweak some settings without having to rebuild the project (datafile, window size, ...).

Usage

This project uses a flight camera to navigate. You can change the view my pressing the left mouse button and dragging. Other controls for the camera are Additionally, the renderer is very interactive, as seen in the example images. Feel free to experiment with the values and how they change the result. To change the SDF texture, the "Recalculate SDF" option needs to be checked first, before any changes are visible. Once done tuning it, we recommend to disable to recalculate the SDF each frame, as the renderer is only doing static visualizations. Changes to the SDF texture are only necessary when the atom positions change (and therefore the SDF texture generation is rather unoptimized and therefore slow).

Examples

Structure of 9J6Y

Structure render of 9J6Y

Structure and Surface with Subsurface Scattering of 5XUY

Structure and surface render of 5XUY with subsurface scattering

Surface with Subsurface Scattering of IBP

Surface render of IBP with subsurface scattering