Doc: document reusable lens maps

This commit is contained in:
wyj committed 2026-09-03 20:58:20 -04:00
1 parent d43ad262fc
commit ab56e23fc9
1 file changed
+49
+49
View File
@@ -54,6 +54,55 @@ synthetic test catalog uses global default exposure `1e-3`; the accelerated
benchmark explicitly uses `1e-5` because its physical Doppler blue shift
otherwise clips the later frames.
## Reuse a completed lens map
Ray tracing and adaptive mesh refinement are independent of catalog lookup,
PSF evaluation, exposure, and tone mapping. `--lens-map-output FILE` writes
the finalized local inverse-lens mesh to one versioned `.grlens` file after all
ray-trace/refinement generations finish; the same invocation still renders its
ordinary image. The file stores every final vertex's image position, camera
direction, infinity direction, frequency shift, terminal status, and the
triangle topology. It also stores the frame dimensions, horizontal FOV, and,
for a movie, all frame IDs and times.
For example, trace an analytic Schwarzschild frame once and retain the map:
```sh
make SPACETIME=schwarzschild backend
mkdir -p output/imgs output/maps
./build/Release/schwarzschild_sky --catalog assets/sky_grid_5deg.csv \
--width 640 --height 360 --coarse-cell-pixels 8 --fov-deg 60 \
--refine-max-level 2 --lens-map-output output/maps/schwarzschild.grlens \
--output output/imgs/schwarzschild_trace.png
```
Later, render that saved map with a different catalog, PSF, or exposure without
constructing an observer, spacetime source, or geodesic rays:
```sh
./build/Release/schwarzschild_sky --lens-map-input output/maps/schwarzschild.grlens \
--catalog assets/sky_grid_5deg.csv --psf-fwhm-pixels 6 --psf-moffat-beta 3 \
--exposure 0.002 --output output/imgs/schwarzschild_restyled.png
```
`--lens-map-input` and `--lens-map-output` are mutually exclusive. An imported
map always retains its original pixel width, height, and horizontal FOV; an
explicit conflicting `--width`, `--height`, or `--fov-deg` is rejected. This is
intentional: the stored inverse map and PSF coordinates are in the original
pixel geometry. The reader validates the format version, finite values, unit
directions, triangle indices, and a per-frame CRC before rendering.
A movie export writes every final frame mesh into the same `.grlens` file.
Export it during the usual movie render, then import it with `--frames-dir` and
`--frames-prefix`; importing a multi-frame map does not require
`--observer-track`:
```sh
./build/Release/minkowski_sky --lens-map-input output/maps/movie.grlens \
--catalog assets/sky_grid_5deg.csv --frames-dir output/imgs \
--frames-prefix restyled
```
PNG is the default output and the default build links `libpng`:
```sh