Blobalizer
Loading...
Searching...
No Matches
Technical Documentation

This is an overview of the inner workings of the rendering implementation of Blobalizer. The rendering is done in 2 passes:

Structure Rasterization Pass

The first pass is a traditional mesh pipeline with a vertex and fragment shader. It is used to rasterize a 3D model of the inner structure of the molecule (a sticks and balls mesh made up of atoms and their interactions). We use ChemStructureShader, a custom shader rendering the inner structure using flat shading. The output is written to an intermediate framebuffer with two color attachments holding the rendered color and the world position of the fragment.

Ray Marching and Composition Pass

The second pass uses Ray Marching to render the solvent-excluded surface (SES) of the molecule. The SES is represented as a signed distance field (SDF) stored inside a 3D texture. It is rendered by determining the entry and exit position into the bounding volume of the SDF grid. Then we step along a ray starting at the entry position in the viewing direction, until we hit the surface of the SES using ray marching. We do this by repeatedly sampling the SDF texture and using its value as our next step size, until the distance falls under some small epsilon value or we exit the bounding volume of the SDF. For a more in-depth explaination see here. We then calculate the normal at point on the surface we hit, by sampling the SDF around this point and interpolating. Afterwards, we again sample the SDF at a fixed distance offset from the surface along the negative normal direction. The value at this location is used to approximate subsurface scattering and brightens the fragment if the evaluated SDF is smaller than the offset used. We then shoot a reflection ray and if we hit, we perform the same subsurface scattering again and incorporate it into the final fragment color. We then also calculate the refraction vector for the original intersection, but we don't use it for further ray marching. It is instead used as an offset for the lookup into the texture written in the first pass. We then simulate transparency of the SES by blending the color of the texture lookup with the color of the surface depending on the depth of the texel.

UI

We use Dear ImGui to render a simple UI through which parameters of the visualization can be manipulated.