Once you've got a view that you want to export in one of the viewers mentioned on the previous page, the next step is to export your 3D figure. The package attempts to make the export process as simple as possible, but we also provide you with some options to optimize the output file for the environment in which you want to share it.
For this sections, we show the export dialog as it appears in Qt glue, but the export dialog has almost the same UI when accessed from Jupyter.
Most of the export options can be set on a layer-by-layer basis, with the exception of the filetype and compression options described below. You can switch layers using the layer selection box.
This option controls how many points (rendered as spherical meshes) are put into each mesh in the export glTF file. Setting this value lower will result in a smaller file due to how the glTF is created, but may negatively impact performance as it will require more draw calls inside the renderer.
For vispy scatter layers, each point is rendered as a spherical mesh. In the output model, we allow setting the resolution of these spherical meshes. Increasing this value leads to a higher-resolution mesh (closer to a sphere), but will increase the filesize, as the spherical geometries now have more points and triangles.
For ipyvolume scatter layers, where each layer uses a glyph with a definite geometry, we simply replicate the geometry of the relevant glyph.
For volume layers, two different export methods are supported:
For isosurface exports, the number of isosurfaces is a configurable parameter, with a value between 1 and 50. These isosurfaces are level curves of the selected primary attribute, evenly spaced between the currently set limits of the layer.
Similar to the volume viewer itself, the intensity at each voxel is computed based on the value of the primary attribute within that voxel. This cutoff sets the minimum opacity for which voxels will be added to the output model; any voxels with a lower opacity will be omitted.
This option allows configuring the resolution of the opacity in the output model - the opacity of each voxel will be rounded to the nearest integer multiple of this value. Increasing this value allows for a smaller filesize (as fewer materials are required for the export), but lowers the degree to which each voxel accurately represents the value of the primary attribute at that point.
As mentioned above, glue-ar supports both glTF/glB and USD formats (USDZ, USDC, and USDA). We also offer partial support for STL files, with the main restriction being that we don't (yet) support exporting materials via MTL. A dropdown in the export dialog allows choosing your desired output file.
For glTF/glB files, glue-ar supports export using both the Draco and Meshopt compression methods. This is achieved using the glTF Transform JavaScript package, which is automatically installed along with glue-ar. Draco and Meshopt can provide significant filesize reduction, making it easier for users to download models served over the internet. However, not all platforms support glTF compression extensions, and so we allow exporting uncompressed models as well. A dropdown in the dialog window allows choosing a compression option if applicable.
For glTF/glB files, glue-ar can also export an HTML file in addition to the glTF. This HTML file provides a display of the exported figure using the model-viewer web component. This model-viewer page provides a THREE.js-powered glTF viewer that, on an AR-capable device (such as an Android or iOS phone) allows viewing the glTF file using the hardware's AR capability. This exported HTML has no additional dependencies and can be served using static file hosting. A checkbox in the dialog allows specifying whether or not to export model-viewer HTML with the model. Note that the exported HTML expects the 3D model to live in the same subdirectory on the file server.