Skip to content

Make a perspective flythrough

Move a perspective camera toward and past a simulated galaxy.

Before you start

Use the THOR and plotting setup, download the galaxy cutout, and install FFmpeg. Put the files below in the same working directory as the cutout. The projected-map tutorial explains the camera and temperature weighting used here.

Configure

Download flythrough.yaml. This is a complete configuration; its camera settings under raytracer.operators.projections include:

mode: traverse
view: perspective
position: [0.525, 0.489, 0.536]
direction: [0.0, 0.0, 1.0]
up: [0.0, 1.0, 0.0]
fov_up: 60
travel_distance: 0.4
nframes: 96
npixels: [384, 256]

The camera travels along +z, passing beside the galaxy. Positions and travel_distance use fractions of the cutout domain; fov_up is the vertical field of view in degrees. It renders 96 frames at 384 × 256 pixels.

Run

thor flythrough.yaml

The run writes flythrough/output.zr. Rerunning replaces that output.

Make the movie

Download plot_flythrough.py and thorplot.py into your working directory, then run:

uv run --python 3.11 --with zarr --with numpy --with matplotlib plot_flythrough.py

In the output movie flythrough.mp4, each frame shows density-weighted temperature along the rays ahead of the camera. The field of view stays fixed while nearby structure grows on screen. A perspective view has no single physical scale across all depths.