Feat: Add soft-clip tone mapping with legacy Reinhard

Replace the per-channel Reinhard display transform with a parameterized
soft clip T_p(x) = tanh(x^p)^(1/p), default softclip p=2, exposed through
--tone-map and --tone-map-p. Keep --tone-map reinhard bit-compatible with
the previous x/(1+x) curve for existing images and reject combining it
with an explicit --tone-map-p.

Route the primary image and the mesh overlay through the same
ToneMapSettings; the linear HDR FITS writer stays pre-tone-map. Add a
focused optics-linked tone-map test target, CLI success/error coverage,
and document the display operator versus the Moffat effective PSF.
This commit is contained in:
wyj committed 2026-09-27 00:44:19 -04:00
1 parent 7399eb6904
commit e31e1ed27e
10 files changed
+359 -30

No files matched your search

+18 -5
View File
@@ -10,7 +10,8 @@ four-dimensional spacetime.
[![Schwarzschild black-hole lensing of the 2MASS Galactic-center star field](assets/images/schwarzschild_galactic_center.png)](assets/images/schwarzschild_galactic_center.png)
*The 2MASS Galactic-center star field seen through Schwarzschild spacetime,
from a camera at radius 100 M. Click the image for the full 4K render;
from a camera at radius 100 M. This reference image uses the legacy Reinhard
tone map (`--tone-map reinhard`). Click the image for the full 4K render;
[rendering command below](#example-galactic-center-field-through-schwarzschild-spacetime).*
Stars are individual catalog point sources with direction, temperature, and
@@ -92,12 +93,14 @@ mkdir -p output/imgs
--all-sky-catalog assets/2mass/processed/all_sky \
--look-ra-deg 296 --look-dec-deg 27 --fov-deg 72 \
--width 3840 --height 2160 --exposure 1e12 \
--tone-map reinhard \
--output output/imgs/summer_triangle.png
```
[![Summer Triangle in flat spacetime, exposure 1e12](assets/images/summer_triangle.png)](assets/images/summer_triangle.png)
*4K reference image with exposure `1e12`. Click to view at full resolution.*
*4K reference image with exposure `1e12`; it uses the legacy Reinhard tone
map (`--tone-map reinhard`). Click to view at full resolution.*
Angles are in degrees; `--fov-deg` is the horizontal field of view. Exposure
is an adjustable display multiplier. Use `--verbose` for progress during long
@@ -119,6 +122,7 @@ mkdir -p output/imgs
--psf-fwhm-pixels 2.7 --psf-moffat-beta 4.5 \
--psf-relative-tail 1e-8 --psf-min-y 0 --max-cache-psf-flux 1e8 \
--catalog-load-workers 4 \
--tone-map reinhard \
--output output/imgs/schwarzschild_galactic_center.png
```
@@ -131,6 +135,11 @@ PNGs. The command above omits the optional HDR and lens-map exports.
This example infers a position facing the hole from its look direction and radius. Adaptive refinement should
be configured for the desired image accuracy; it is disabled by default.
Tone-mapped PNG/PPM output uses a per-channel soft-clip display transform by
default (`--tone-map softclip --tone-map-p 2`); `--tone-map reinhard` restores
the historical curve used by the reference images above. The linear HDR FITS
output never applies it. See [tone mapping and
display](usage.md#tone-mapping-and-display).
Camera controls, movie sequences, lens-map reuse, PSF settings, and HDR output
are described in [usage.md](usage.md). For fast single-frame previews,
`--fast-mode` replaces per-event PSF splats with a supersampled delta deposit
@@ -158,13 +167,15 @@ mkdir -p output/imgs
--width 3840 --height 2160 --fov-deg 90 \
--coarse-cell-pixels 16 --refine-max-level 3 \
--exposure 0.01 \
--tone-map reinhard \
--output output/imgs/schwarzschild_near_horizon_outward_R2.1_0.01_refine3.png
```
[![Synthetic stellar sky seen outward by a static observer at r=2.1M](assets/images/schwarzschild_near_horizon_outward_R2.1_0.01_refine3.png)](assets/images/schwarzschild_near_horizon_outward_R2.1_0.01_refine3.png)
*4K render with a 90° horizontal field of view, exposure `0.01`, and maximum
refinement level 3. Click to view at full resolution.*
refinement level 3; it uses the legacy Reinhard tone map (`--tone-map
reinhard`). Click to view at full resolution.*
The distant sky occupies a bounded angular region around the outward
direction, with repeated images crowded near its edge. Strong gravitational
@@ -190,13 +201,15 @@ mkdir -p output/imgs
--coarse-cell-pixels 32 \
--observer-radius 100 --exposure 0.2 \
--psf-fwhm-pixels 2.7 --psf-moffat-beta 4.5 --draw-mesh \
--tone-map reinhard \
--output output/imgs/schwarzschild_test_grid.png
```
[![Synthetic stellar grid lensed by a Schwarzschild black hole, with adaptive mesh overlay](assets/images/schwarzschild_test_grid_mesh.png)](assets/images/schwarzschild_test_grid_mesh.png)
*4K test-grid reference image showing the `_mesh.png` overlay. Click to view at
full resolution.*
*4K test-grid reference image showing the `_mesh.png` overlay; it uses the
legacy Reinhard tone map (`--tone-map reinhard`). Click to view at full
resolution.*
### Freely falling Schwarzschild movie camera