← All posts

Quantum Orbitals in 165 Lines: Building a 3D Visualization Without a 3D Engine

2023Python · Scientific Viz

Some concepts stay abstract because most representations flatten them too early. Atomic orbitals are one of those. Textbooks show shapes. They rarely let you inspect them. I wanted to see what happened if those shapes became something I could rotate, switch, and render in real time.

Building the Projection Myself

This was a small project, but one decision made it more interesting than it looked. I did not use a 3D engine. I wrote the projection and rotation math directly, then pushed the output through Pygame. That forced me to think about transformations instead of hiding behind a graphics library.

The orbital data came from NumPy grids. I used vectorized calculations to generate approximations for s, p, and d orbitals across a 200 by 200 field, then projected those points into screen space. That part taught me how much mileage you can get from basic math and array operations.

One small detail I liked was orbital switching through keyboard input. Press a key and the shape changes immediately. It made the project feel exploratory instead of static.

What the Project Actually Taught Me

This was partly a chemistry visualization project and partly an excuse to learn rendering.

I also added a slight vibration effect. It was not physically rigorous. It just made the scene feel less frozen. Small touches like that started teaching me that simulations are often as much about perception as raw correctness.

What Did Not Work Well

Some parts were rough. The renderer draws around forty thousand points and it shows. Performance drops were real. The fixed point size also made density harder to read than it should have been.

I set the frame rate absurdly high. Looking back, that was a beginner mistake. Sixty would have been enough. Three thousand was noise.

The orbital equations were simplified too. This was visualization-first, not a serious quantum model. If I revisited it, I would add better normalization, slicing views, and probably separate the whole thing into modules instead of packing everything into one file.

Small Project, Useful Shift

This was not a massive system. It was an early project built from curiosity. But it changed how I thought about scientific software. Visualization is not decoration. Sometimes it is the interface for understanding.

Good learning projects do not need scale. They need friction worth wrestling with.

View all projects →View on GitHub ↗