expose the tonemap #125

Merged
sermuns merged 3 commits from feat/86-90-use-the-normal-maps-the-assets-ship into main 2026-10-21 10:55:09 +00:00
Owner
  • (slop) expose the tonemap
  • (slop) use the normal maps the assets ship

closes #86 closes #90

What the worker did

Left out on purpose: tangent attributes at import (the issue lists the derivative route first, and it keeps Asset/the scene builder out of it); the distance filtering (#76, already on main) and the model variety (#87, already on main) are separate issues.

#90 — Expose the tonemap

Commit: 0808994 — (slop) expose the tonemap (closes #90)
What changed:

  • liuverse-render/src/shaders.rs: the present pass multiplies the HDR colour by G.params.w before tone_mapping (after it, the ACES clamp would swallow the brightening and the knob could only darken).
  • liuverse-render/src/renderer.rs / lib.rs: RenderConfig::exposure and Renderer::set_exposure; the value rides in the globals' padding slot (params.w), so it needs no pipeline or texture.
  • liuverse/src/settings.rs: --exposure and ?exposure=, clamped to EXPOSURE_RANGE, NaN and garbage ignored.
  • liuverse/src/hud.rs / main.rs: an "exposure" slider in the pause menu. It applies while it is dragged (wanted_exposure prefers the menu's copy while the menu is open), so the campus can be watched while it is fixed — the other menu rows only apply on close, which would make an exposure knob unusable.
    A human sees: a brightness knob in the pause menu, and --exposure 1.5 / ?exposure=1.5 for a deliberate screenshot or a dim monitor.
    Left out on purpose: auto-exposure (the issue names it as the follow-up, and it needs the bloom/downsample work); per-preset exposure and fading — there is no preset concept in the code yet, and #92 owns that.

Notes for the coordinator

  • just check passes on the branch (fmt, clippy -D warnings on --workspace --all-targets, cargo test --workspace, cargo deny).
  • The branch base is behind main: main has since landed #76 (linear mip filtering/anisotropy), #77 (present-pass dither) and #87 (per-instance tree tint). Merging main into this branch conflicts in three files — ARCHITECTURE.md, liuverse-render/src/renderer.rs, liuverse-render/src/shaders.rs. I resolved all three in a throwaway worktree (both sides kept: globals_params alongside lit_sampler; the tint multiply alongside the normal-map block; exposure → tone_mapping → dither in the post pass) and the result compiles, passes clippy and passes every test. The resolutions are mechanical.
  • assets/baked/valla.bin was not touched.

How to test

See the issues for the acceptance criteria. The branch is feat/86-90-use-the-normal-maps-the-assets-ship.

A 👍 reaction on this pull request flags it for merge.

- (slop) expose the tonemap - (slop) use the normal maps the assets ship closes #86 closes #90 ## What the worker did **Left out on purpose:** tangent attributes at import (the issue lists the derivative route first, and it keeps `Asset`/the scene builder out of it); the distance filtering (#76, already on `main`) and the model variety (#87, already on `main`) are separate issues. ## #90 — Expose the tonemap **Commit:** `0808994` — `(slop) expose the tonemap` (closes #90) What changed: - `liuverse-render/src/shaders.rs`: the present pass multiplies the HDR colour by `G.params.w` **before** `tone_mapping` (after it, the ACES clamp would swallow the brightening and the knob could only darken). - `liuverse-render/src/renderer.rs` / `lib.rs`: `RenderConfig::exposure` and `Renderer::set_exposure`; the value rides in the globals' padding slot (`params.w`), so it needs no pipeline or texture. - `liuverse/src/settings.rs`: `--exposure` and `?exposure=`, clamped to `EXPOSURE_RANGE`, NaN and garbage ignored. - `liuverse/src/hud.rs` / `main.rs`: an "exposure" slider in the pause menu. It applies **while it is dragged** (`wanted_exposure` prefers the menu's copy while the menu is open), so the campus can be watched while it is fixed — the other menu rows only apply on close, which would make an exposure knob unusable. **A human sees:** a brightness knob in the pause menu, and `--exposure 1.5` / `?exposure=1.5` for a deliberate screenshot or a dim monitor. **Left out on purpose:** auto-exposure (the issue names it as the follow-up, and it needs the bloom/downsample work); per-preset exposure and fading — there is no preset concept in the code yet, and #92 owns that. ## Notes for the coordinator - `just check` passes on the branch (fmt, clippy `-D warnings` on `--workspace --all-targets`, `cargo test --workspace`, `cargo deny`). - The branch base is behind `main`: `main` has since landed **#76** (linear mip filtering/anisotropy), **#77** (present-pass dither) and **#87** (per-instance tree tint). Merging `main` into this branch conflicts in three files — `ARCHITECTURE.md`, `liuverse-render/src/renderer.rs`, `liuverse-render/src/shaders.rs`. I resolved all three in a throwaway worktree (both sides kept: `globals_params` alongside `lit_sampler`; the tint multiply alongside the normal-map block; `exposure → tone_mapping → dither` in the post pass) and the result compiles, passes clippy and passes every test. The resolutions are mechanical. - `assets/baked/valla.bin` was **not** touched. ## How to test See the issues for the acceptance criteria. The branch is `feat/86-90-use-the-normal-maps-the-assets-ship`. A 👍 reaction on this pull request flags it for merge.
The trees ship bark normal maps, but nothing read them: the surface was
lit by its geometric normal alone and looked flat.

Each asset that names a normal map now binds one. The tangent frame is
derived from screen-space derivatives of the world position and the UVs,
so the vertex format and every existing vertex buffer stay as they are.

A normal map holds directions, not colors, so its bytes are uploaded as
they were authored instead of being sRGB-linearized like an albedo.

closes #86
The ACES curve is fixed, so a dim display could not be fixed and a
screenshot could not be taken on purpose.

The exposure rides in the globals' padding slot and scales the HDR color
before the curve, where it can still brighten anything: applied after it,
the curve's clamp would swallow the brightening. It is set from the pause
menu, from `--exposure` and from `?exposure=`, and the knob applies while
it is dragged, so the campus can be watched while it is fixed.

closes #90
sermuns force-pushed feat/86-90-use-the-normal-maps-the-assets-ship from 0808994ca5 to c76ab9b065 2026-10-21 10:54:50 +00:00 Compare
Sign in to join this conversation.
No description provided.