Date: Mon, 30 May 2022 18:19:15 -0400
From: Luke Iannini
Subject: Protein rendering with GPU Kit
[video.webm]

It's now possible to draw in the deepest dimension, for those longing for the endless immensity of the Z!

Here's an interactive protein renderer in 48 lines, which I think is pretty darn cool.

A "scene" is a collection of 3D geometries, which can then be rendered with one or more configurable cameras. Geometries so far are just spheres and paths, though paths are pretty fancy and we can draw a heck of a lot of spheres — and it's a snap to add more geometries as we need them. Paths are specified by providing a list of points and colors, which are then interpolated using Catmull-Rom and expanded volumetrically via an arbitrary 2D shape that is swept through the interpolated points. Cameras can be orthographic or perspective with variable FOV, and oriented with position+axis+angle. Scenes ultimately render to  images drawn with Drawings so they integrate nicely with the existing drawing pipeline + priorities (you can pass priority to "Wish (you) displays scene").

There's a "Protein structure" page (temporarily filed in Render Kit) that provides "When protein /protein/ has structure /structure", which downloads and parses PDB files into atoms, helices and residues.


See page 38287 for the basic ball-and-stick example.

Features up next: more geometries, the ability to draw Realtalk's existing 2D illuminations positioned relative to the 3D geometry (for e.g. labels and highlights), point-scene tests for e.g. using a whisker to point at a specific amino acid and cross-reference it with the source data, integration with Drawings so we can generate PDF figures from these, and anything else y'all ask for : )

This was a fun opportunity to test GPU Kit, and it passed with flying perspective-correct colors, by my rubric!