Date: Mon, 27 Jun 2022 20:15:32 -0400
From: Luke Iannini
Subject: Re: July demo
Very exciting Shawn!!

OK, two more features hot off the presses: printing scenes (example: 38995), and functional orthographic cameras (example: 38997)

The API for printing a scene is a little funny but it does the job for now — the example should hopefully be self explanatory! I added the ability to pass a custom clear color to the scene renderer to allow for the usually-desired white background when rendering for printing rather than illumination (don't forget this or you'll use up a lot of black ink!).

Orthographic cameras add two more options to the camera table:
extent specifies how far across you want your view of the world to be
bounds lets you manually specify the left, right, top and bottom planes for your view

Bounds overrides extent if set, and by default, extent is set to the width of the page — when orthographic=true the camera is also translated such that the origin is in the top left (rather than the default center of the page used for traditional perspective rendering).

So, all that is to say, most of the time you can just set orthographic=true and then specify positions in page/supporter space, scale and rotate your objects to taste, and use Z solely for controlling occlusion.



On Jun 27, 2022, at 3:07 PM, Shawn Douglas wrote:

I've been using Luke's new Scene kit to render 3D models of DNA origami from GSD files:

<render-gsd.jpg>
38709 -- 6h x 63nt GSD file
38955 -- Import gsd
38957 -- Render gsd

The GSD files are output from our Python-based simulation scripts, which use coarse-grain models (3 spheres per dsDNA base pair, or 2 spheres per ssDNA nt). It's possible to convert from coarse-grain to atomic models, in PDB format, for example if we wanted to display the DNA stage together with the bound protein, or pipe them into cryo-EM analysis tools.

The scene layout above is tailored to this particular GSD file. Once we have wishes that handle batched geometry, we can easily adapt this to center and scale for any input. Orthographic cameras will help a lot!

Also, I have been working on a page that will generate the printed portion of a paper DNA block model:
<paper-dna-blocks.jpg>
38949 -- Paper DNA blocks

I adapted a page from Luke (38855), and leveraged Print Kit's "Printing dot frames" to display dot frames on each box face. 
Everything is scaled from a dot_radius parameter.  

Relative dimensions of the faces can be specified, for example, here's a 1x1x1 block:
<paper-dna-blocks-2.jpeg>

I had assumed we would use normal dot frames with the corner wedges, and treat each block face like a small page. To fit the 6h-63nt block on letter-sized paper, I had to reduce dot_radius to 0.06. If we want to use a radius of 0.1, it seems we'll have to adapt dot-frame recognition to handle non-frame layouts, like the little grids that Bret taped to the paper block in the recent video.

I understand that Luke is adding support for printing 3D scenes. Once that's available, we can merge these two threads so we can point at any GSD file, and print out the paper template to fold into the physical block model, including accurate views of the DNA on each face!

For the demo, I can manually cut these on the silhouette. Eventually, we can port the code to generate the cut patterns (I used Clement Zheng's Joinery webtool), build our own drivers for the silhouette, and then set up a little DNA-block printing & cutting station in the dry lab space.