3D models in Flux

Import a model, choose its view, and work with named parts, value fields and shape states.

6 min readFigures

Import a model

Import a GLB mesh through Import, drag it onto the canvas, or pick its 3D tile in the gallery. Flux keeps a project copy, so sharing the project does not depend on the original file. A plain GLB supplies geometry and colours. A 3D fluxplot also supplies named parts, physical size, axes, labels, value fields and optional shapes through the matching .fluxplot.json file. Keep that file beside the GLB when importing. An invalid, newer or mismatched manifest produces a warning and leaves the geometry available as a plain mesh.

3D models need a saved project. In a project you have not saved yet, importing a GLB first asks you to save it; then the file picker opens again, so pick the files a second time. Cancelling that second picker keeps the saved project. Dragged-in files need no second pick. If preparing a model takes more than a second, a notice names the files still being imported. A placed model shows a dashed outline while its image is prepared, and “Preparing 3D preview” only if that takes longer than a second.

Create a 3D fluxplot in Python

In Python, start a scene, add your mesh and save it into plots/. This needs a fluxplot release with fp.scene3d; install or update fluxplot if needed. 3D plots covers scenes, value fields and shape states in depth.

import fluxplot as fp

# vertices: an N×3 array of coordinates
# faces: an M×3 array of vertex indices
sc = fp.scene3d(figsize=(3.5, 3),
                units="µm", up="z",
                axes="triad")
fp.mesh3d(sc, (vertices, faces),
          series="neuron",
          color="#4385be")
sc.view(azimuth=30, elevation=20)
fp.save(sc, "plots/neuron")

figsize is in inches; up describes your data coordinates. The gallery inserts that physical size. In a trusted notebook, displaying sc opens the interactive viewer. Use Copy view and paste the sc.view(...) line it produces into your code, then save to make that angle the scene’s Home view. In the viewer, click the model (or hold Ctrl) before scrolling to zoom; otherwise scrolling moves the notebook as usual. For a static output, use sc.show(static=True).

Update from source

After rerunning Python, Source changed appears in the Inspector and as a dot in Layers, together with Update from source. Choose it to accept the new geometry and metadata. Your box, camera and look stay in place; restyles and field settings remain for surviving part IDs, and shape weights remain for surviving names. Flux warns when parts disappear or bounds move substantially. Undo restores the previous stored model. Source changes never replace the model automatically. A missing original file leaves the saved copy available. For a recipe-backed model, Regenerate in X-ray reruns the recipe with its parameters and applies the same update after it succeeds.

Orbit and views

Double-click the mesh, or choose Orbit in the Inspector, to turn it. While you orbit, the button reads Done and a hint over the model lists the keys:

Shortcut Action
Drag Orbit around the model
Shift+drag Pan within the model’s box
Alt+drag Roll the camera
Wheel Zoom the model
← → ↑ ↓ Turn the view in 5° steps (Shift for 15°)
1–6 The six axis views, as on the Inspector’s view buttons
0 Home view and saved shape weights
P Switch orthographic / perspective
Enter Finish, like Done; one Undo restores the previous view
Escape Cancel the whole orbit visit

Clicking outside the model also finishes. Space+drag and Ctrl+wheel return to canvas navigation. Double-clicking a label, colorbar, legend or scale bar selects that part instead, as with a 2D plot’s parts.

The 3D model panel

The Inspector’s 3D model panel is grouped into sections:

Resizing the box reframes the model while labels keep their physical type size. A physical scale bar is shown only in orthographic view. The default view fits the model snugly; with box axes it fits the whole axes box, so ticks and labels stay inside the frame. Looking almost straight down one axis shrinks it to a short stub. Its tick labels are then hidden rather than stacked on top of each other, and so is its title if the title is longer than the stub. The axis line, ticks and grid stay.

Parts, value fields and shapes

Use Alt+R for the model’s X-ray. Named mesh parts can be recoloured, hidden or made transparent; labels can be restyled independently. Mesh-part colours show while Colours is From file, so painting a mesh part on a Uniform model switches it to From file (one undo, with a notice). For a continuous value field, change its colormap and Min / Max under Value fields: the mesh and colorbar update together, without rerunning Python. A part colour overrides its value field; Reset part colour restores field colouring.

If the GLB has named shape states, Shape offers live weights from 0 to 1. A sequence instead starts with a Frame control: 0 is the base, 1 onwards are the saved shapes, and fractional values blend neighbouring frames. Custom means the current weights are not a sequence frame. Reset shape restores the saved weights. Stored scientific weights can extend beyond the slider range.

Export and limits

PNG and TIFF exports rasterize the result at the requested print size. SVG and PDF keep the mesh as a high-resolution image while axes, labels, legends and scale bars remain vector artwork. Paper uses the saved figure view in its embeds and document exports. Large meshes can be reduced at creation with fp.mesh3d(..., max_faces=...); this uses the optional fluxplot[mesh] extra. Texture images are omitted and skinning is ignored: Flux shows the stored mesh geometry, so bake a desired pose before exporting the GLB. Point and line primitives are refused; export triangle meshes.

Troubleshooting

Symptom Cause → fix
I see a grey 3D tile Read the message inside it. Restore a missing GLB, or enable graphics support if rendering is unavailable. Saved posters can still display when a new render cannot be made.
Orbit won’t start A notice says why: the model is locked or hidden (unlock or show it), its file is missing, rendering is unavailable, or another editing mode owns the interaction. Resolve that condition, then choose Orbit again.
Saving says a 3D model file is missing The model’s GLB was moved or deleted from the project’s fig/assets/ folder. The figure still opens with a grey tile in its place, and saving waits. Put the named file back and save again, or select the model and delete it: saving resumes and the rest of the figure is untouched. Ctrl+Z brings the model back, and saving waits again until its file returns. If the message says a deck still uses the file, restore it or delete that model from the deck.
Notebook labels look different In a notebook, the interactive viewer uses browser fonts; the PNG fallback uses Python’s font renderer. Install the same font in both environments. Placement and point sizes remain explicit.
Notebook output is blank In an untrusted notebook, VS Code can suppress an entire mixed HTML/PNG output. Trust the notebook if appropriate, or run sc.show(static=True) to request only the PNG. See 3D plots.

Search the docs

Search guides, workspaces, and reference topics.

↑ ↓ to move · Enter to open · Esc to close