MolForma

3D rendering

Hydrogen bonds shown for ACE–Ala–Glu–NME, with the distance between the terminal methyl carbons C27 and C33 kept in the view: a blue dashed line between H34 and O17, and a purple dashed line with 10.200 Å between C27 and C33

Figure 1 The blue dashed line of “View → Show hydrogen bonds” (H34···O17) and a distance kept with “Show measurement of selection in view” (purple dashed line, C27–C33).

Caffeine shown space-filling (CPK) without labels

Figure 2 “View → Display style → Space-filling (CPK)” (caffeine, no labels).

Regular CTest runs need no display server and test the QPainter path together with editing, candidates and undo. The VTK path can be tested separately for display positions and click coordinates, translucency, isosurface retention during rotation and PNG capture.

xvfb-run -a env QT_QPA_PLATFORM=xcb MOLFORMA_REQUIRE_VTK=1 \
  MOLFORMA_RENDER_ARTIFACTS=/tmp/molforma-rendering ./build/test_rendering

Compare rendering performance with the same display environment, view size and shapes. The following optional benchmark rotates 10,000, 50,000 and 100,000 triangles in an 800×600 view and prints the median and the 95th percentile of 30 frames after a warm-up. The times are not used to pass or fail the test. Under Xvfb the values usually reflect software OpenGL; to assess a real GPU, run it on the actual display.

MOLFORMA_RENDER_BENCHMARK=1 ./build/test_rendering rotationBenchmark
MOLFORMA_RENDERER=painter MOLFORMA_RENDER_BENCHMARK=1 ./build/test_rendering rotationBenchmark

Measured on 2026-10-23 with an NVIDIA GeForce GTX 1060 6GB, NVIDIA 580.178.04, Qt 6.12.0, VTK 9.7.1 and xcb, using a sphere colored by sign, opacity 150/255 and 3 atoms, and compared with the QPainter path of the same build (including its caching optimizations). The roughly 16.7 ms of the VTK path corresponds to the 60 Hz sync of this display and does not represent the processing time of the GPU itself.

Triangles QPainter median VTK median
10,000 22.29ms 16.71ms
50,000 63.17ms 16.72ms
100,000 111.69ms 16.71ms

For 100,000 triangles, the 95th percentile was 126.60 ms with QPainter and 17.74 ms with VTK. Results vary with the overlap of shapes, the resolution, the GPU and the driver.

See also: “1 Molecule”: layout, tools and selection, “Result viewer”, the list of pages in “Features”.