Quantik v1.0.0 - A Molecule 3D Viewer with no 3D engine
What is this ?
Quantik is a Molecule 3D Viewer built in Rust. You open a .sdf file (or pick a built-in molecule), and you can rotate it, zoom, pan, and hover every atom to see its info.
And the fun part: there is no 3D engine and no GPU code. Everything (the projection, the depth buffer, the lighting, the triangle filling) is done by hand on the CPU, and the pixels are just sent to a window with minifb ദ്ദി(˵ •̀ ᴗ - ˵ ) ✧
Why ( °ヮ° ) ?
I had 3 reasons: I wanted a 3D molecule viewer that my teacher could use in class, I wanted to really learn how 3D works in depth (so I did it from scratch), and I wanted to use it myself for homework, because most of this kind of software is Windows-only and I use a mac.
Core Features ( ദ്ദി ˙ᗜ˙ )
Viewer
- Atoms as spheres and bonds as cylinders (double and triple bonds are drawn as parallel cylinders)
- CPK colors and real van der Waals radii
- Orbit camera with mouse and keyboard, plus auto rotate
- Hover an atom to see its name, radius and molar mass
- Info panel with the name, formula, number of atoms, number of bonds and total molar mass
Software Renderer
- Depth buffer, back-face culling, key + fill lighting
- SSAA anti-aliasing: low quality while you move the camera, 3x when you stop
- Redraw on demand: the scene is only re-rendered when something changed
- Atom ID buffer: each pixel remembers which atom drew it, that’s how hovering works
Molecule Loading
- Open any
.sdffile with a native file dialog - Built-in examples: Water, Methane, Ammonia, Benzene and Ethanol
- Auto framing: the camera is placed from the size of the molecule
What was challenging ?
Getting the 3D maths right without an engine was the hardest part: projecting the points, filling the triangles, and making the depth correct with perspective. Also, doing everything on the CPU is slow, so I had to be smart: a low quality render while the camera moves, a high quality one when it stops, and only redrawing when something changed. After that I split the whole project into modules (render, mesh, camera, molecule, ui…) because it was getting hard to read ദ്ദി(˵ •̀ ᴗ - ˵ ) ✧
What are you proud of ?
I’m proud that the whole 3D pipeline is mine, and that it is actually useful: my teacher can use it in class, and it runs on macOS, Windows and Linux without any 3D engine or GPU.
What should people know so they can test your project ?
- Go to the GitHub Release and download the version for your OS
- macOS: the app is not signed (I don’t have an Apple Developer account 🥲), so run
xattr -cr /Applications/Quantik.appin the Terminal after you put it in Applications - Windows: SmartScreen may warn you, click More info then Run anyway
- Launch Quantik, then use
File > Open...(Cmd/Ctrl+O) to load an.sdffile, orExamples > Show list(Cmd/Ctrl+E) and press1-9
Things to try
- Load the Water example
- Hover an atom to see its info
- Press
Spaceto make the molecule spin, then-/=to change the speed - Rotate the camera and stop: watch the image get smoother
- Download a molecule as
.sdf(for example the Caffeine one from PubChem) and open it
Thank you
Just a little thank you ❤️
(Everything you need is probably in the README.md)
- 5 devlogs
- 24h


.
. And here is a list of everything I added:
So you can import every molecule you want !
(now you don’t even see the “edge of the UV sphere and the cylinder)


) And implementing the tool bar too.
I added the same tools as in the EGUI version : Shift (Left, Right, Down, Up) and Rotate (it wasn’t difficult at all)