Skip to content

Minecraft: Java Edition 26.3 rewritten from scratch in Rust, checked against vanilla with 281 differential harnesses. Get it with the Horizon launcher.

HDR: plain numbers on its screen, black level on Auto, the shortcut only in a world

Senjin52219e47718f
diff --git a/crates/horizon-client-render/src/gfx.rs b/crates/horizon-client-render/src/gfx.rs
index 7bb9bb7ce..a69f03ae9 100644
--- a/crates/horizon-client-render/src/gfx.rs
+++ b/crates/horizon-client-render/src/gfx.rs
@@ -8829,6 +8829,14 @@ mod tests {
assert!(!drawable_size(984, u32::MAX, 32768));
}
+ #[test]
+ fn a_reported_black_level_rounds_down() {
+ use super::hundredths_of_a_nit as h;
+ assert_eq!(h(0.005), 0);
+ assert_eq!(h(0.05), 5);
+ assert_eq!(h(5.0), 100);
+ assert_eq!(h(f32::NAN), 0);
+ }
#[test]
fn os_luminances_become_auto_values() {
use super::os_reported;
@@ -8846,14 +8854,16 @@ mod tests {
os_reported(&info(Some(998.4), Some(240.0))),
Some(Reported {
paper_white: 240,
- peak: 998
+ peak: 998,
+ black: 0
})
);
assert_eq!(
os_reported(&info(Some(120.0), Some(1000.0))),
Some(Reported {
paper_white: 480,
- peak: 480
+ peak: 480,
+ black: 0
})
);
// White above the calibrated peak (a Samsung QD-OLED's 380, the slider at 456).
@@ -8861,7 +8871,8 @@ mod tests {
os_reported(&info(Some(380.0), Some(456.0))),
Some(Reported {
paper_white: 456,
- peak: 456
+ peak: 456,
+ black: 0
})
);
assert_eq!(os_reported(&info(Some(1000.0), None)), None);
@@ -9644,6 +9655,15 @@ fn flush_display_log() {
(log.last, log.at) = (line, Some(now));
}
}
+/// A reported black level, within the setting's range. Rounded down: OLEDs report a figure
+/// just above 0, like KWin's 0.005, which isn't worth lifting the shadows for.
+fn hundredths_of_a_nit(nits: f32) -> u32 {
+ if nits.is_finite() && nits > 0.0 {
+ ((nits * 100.0) as u32).min(100)
+ } else {
+ 0
+ }
+}
fn log_os_reported(reported: Option<crate::graphics::Reported>) {
log_display(match reported {
Some(r) => format!(
@@ -9666,6 +9686,7 @@ fn os_reported(info: &wgpu::DisplayHdrInfo) -> Option<crate::graphics::Reported>
let paper_white = (white.round() as u32).clamp(80, 480);
Some(crate::graphics::Reported {
paper_white,
+ black: hundredths_of_a_nit(luminance.min_nits.unwrap_or(0.0)),
// Windows' SDR brightness slider can set white above the reported peak (480 against
// a calibrated 380): the highlights then stay at white instead of dropping below it.
peak: (peak.round() as u32).clamp(200, 10_000).max(paper_white),
@@ -9691,5 +9712,6 @@ fn reported(l: horizon_hdr::wayland::Luminances) -> crate::graphics::Reported {
crate::graphics::Reported {
paper_white: 203,
peak: peak.clamp(200, 10_000),
+ black: hundredths_of_a_nit(l.target_min * 203.0 / l.reference.max(1.0)),
}
}
diff --git a/crates/horizon-client-render/src/graphics.rs b/crates/horizon-client-render/src/graphics.rs
index 4edbec8bb..cd63c9c85 100644
--- a/crates/horizon-client-render/src/graphics.rs
+++ b/crates/horizon-client-render/src/graphics.rs
@@ -19,20 +19,28 @@ pub const HDR_MARKER: &str = "horizon-hdr-pending";
pub struct Reported {
pub paper_white: u32,
pub peak: u32,
+ /// The display's darkest black, in hundredths of a nit.
+ pub black: u32,
}
-static REPORTED: [AtomicU32; 2] = [AtomicU32::new(0), AtomicU32::new(0)];
+static REPORTED: [AtomicU32; 3] = [AtomicU32::new(0), AtomicU32::new(0), AtomicU32::new(0)];
/// Sets what the system reports (the renderer, when it opens its surface).
pub fn report(reported: Option<Reported>) {
- let (paper_white, peak) = reported.map_or((0, 0), |r| (r.paper_white, r.peak));
+ let (paper_white, peak, black) =
+ reported.map_or((0, 0, 0), |r| (r.paper_white, r.peak, r.black));
REPORTED[0].store(paper_white, Ordering::Relaxed);
REPORTED[1].store(peak, Ordering::Relaxed);
+ REPORTED[2].store(black, Ordering::Relaxed);
}
/// What the system reports, if it does.
pub fn reported() -> Option<Reported> {
- let [paper_white, peak] = REPORTED.each_ref().map(|n| n.load(Ordering::Relaxed));
- (peak > 0).then_some(Reported { paper_white, peak })
+ let [paper_white, peak, black] = REPORTED.each_ref().map(|n| n.load(Ordering::Relaxed));
+ (peak > 0).then_some(Reported {
+ paper_white,
+ peak,
+ black,
+ })
}
/// Simple-level presets. `Custom` leaves every option as the player set it.
@@ -582,8 +590,9 @@ pub struct Graphics {
/// HDR peak brightness the world's highlights reach, in nits; 0 is Auto:
/// what the system reports for the display ([`Graphics::peak_nits`]).
pub hdr_peak: u32,
- /// HDR black level: the display's darkest black, in hundredths of a nit (0 for
- /// an OLED's true black). Shadows are lifted onto it, and the HDR metadata says it.
+ /// HDR black level: the display's darkest black, in hundredths of a nit; 0 is Auto:
+ /// what the system reports, else true black. Shadows are lifted onto it, and the HDR
+ /// metadata says it.
pub hdr_black_level: u32,
/// HDR brightness of the HUD and menus, in percent of paper white (25..=100); the
/// first-person hand stays at the world's.
@@ -828,6 +837,14 @@ impl Graphics {
n => n,
}
}
+ /// The black level, in nits: the player's, or on Auto what the system reports, else 0.
+ pub fn black_level_nits(&self) -> f32 {
+ let hundredths = match self.hdr_black_level {
+ 0 => reported().map_or(0, |r| r.black),
+ n => n,
+ };
+ hundredths as f32 / 100.0
+ }
/// Worker threads for chunk generation and meshing.
pub fn worker_threads(&self) -> usize {
if self.workers > 0 {
diff --git a/crates/horizon-client-render/src/graphics_ui.rs b/crates/horizon-client-render/src/graphics_ui.rs
index afc154001..961354573 100644
--- a/crates/horizon-client-render/src/graphics_ui.rs
+++ b/crates/horizon-client-render/src/graphics_ui.rs
@@ -598,24 +598,21 @@ impl H {
H::HdrPaperWhite => match g.hdr_paper_white {
0 => labelled(
"Paper White",
- lang::tr("Auto (%s nits)", &[&g.paper_white_nits()]),
+ lang::tr("Auto (%s)", &[&g.paper_white_nits()]),
),
- n => labelled("Paper White", lang::tr("%s nits", &[&n])),
+ n => labelled("Paper White", n.to_string()),
},
H::HdrPeak => match g.hdr_peak {
+ 0 => labelled("Peak Brightness", lang::tr("Auto (%s)", &[&g.peak_nits()])),
+ n => labelled("Peak Brightness", n.to_string()),
+ },
+ H::HdrBlackLevel => match g.hdr_black_level {
0 => labelled(
- "Peak Brightness",
- lang::tr("Auto (%s nits)", &[&g.peak_nits()]),
+ "Black Level",
+ lang::tr("Auto (%s)", &[&format!("{:.2}", g.black_level_nits())]),
),
- n => labelled("Peak Brightness", lang::tr("%s nits", &[&n])),
+ n => labelled("Black Level", format!("{:.2}", n as f32 / 100.0)),
},
- H::HdrBlackLevel => labelled(
- "Black Level",
- lang::tr(
- "%s nits",
- &[&format!("{:.2}", g.hdr_black_level as f32 / 100.0)],
- ),
- ),
H::HdrUiBrightness => labelled("UI Brightness", format!("{}%", g.hdr_ui_brightness)),
H::HdrKey => {
Text::translate("Shortcut: %s", &[crate::keybinds::display_name(&g.hdr_key)])
diff --git a/crates/horizon-client-render/src/hdr_calibration.rs b/crates/horizon-client-render/src/hdr_calibration.rs
index 5687aff92..a7b904e51 100644
--- a/crates/horizon-client-render/src/hdr_calibration.rs
+++ b/crates/horizon-client-render/src/hdr_calibration.rs
@@ -49,7 +49,7 @@ pub struct Calibration {
values: [f32; 3],
/// Which values were Auto (peak, paper white): saved as Auto again unless the
/// player moved them.
- auto: [Option<f32>; 2],
+ auto: [Option<f32>; 3],
dragging: bool,
}
@@ -125,11 +125,12 @@ impl Calibration {
Self {
step: 0,
values: [
- g.hdr_black_level as f32 / 100.0,
+ g.black_level_nits(),
g.peak_nits() as f32,
g.paper_white_nits() as f32,
],
auto: [
+ (g.hdr_black_level == 0).then_some(g.black_level_nits()),
(g.hdr_peak == 0).then_some(g.peak_nits() as f32),
(g.hdr_paper_white == 0).then_some(g.paper_white_nits() as f32),
],
@@ -146,15 +147,11 @@ impl Calibration {
fn label(&self) -> Text {
let v = self.values[self.step];
let step = self.current();
- let nits = match step {
+ let value = match step {
Step::Black => format!("{v:.2}"),
_ => format!("{v:.0}"),
};
- Text::literal(format!(
- "{}: {}",
- step.name(),
- lang::tr("%s nits", &[&nits])
- ))
+ Text::literal(format!("{}: {}", step.name(), value))
}
/// The step, its nits and where the controls start (a share of the height), for
/// HDR output's test picture.
@@ -284,11 +281,12 @@ impl Calibration {
/// Writes what the player landed on into Horizon's settings.
pub fn save(&self, s: &mut Settings) {
let g = &mut s.horizon;
- g.hdr_black_level = (self.values[0] * 100.0).round() as u32;
- let [peak, paper_white] = [1, 2].map(|i| match self.auto[i - 1] {
+ let scale = [100.0, 1.0, 1.0];
+ let [black, peak, paper_white] = [0, 1, 2].map(|i| match self.auto[i] {
Some(auto) if auto == self.values[i] => 0,
- _ => self.values[i].round() as u32,
+ _ => (self.values[i] * scale[i]).round() as u32,
});
+ g.hdr_black_level = black;
g.hdr_peak = peak;
g.hdr_paper_white = paper_white;
}
diff --git a/crates/horizon-client/assets/horizon/lang/de_de.json b/crates/horizon-client/assets/horizon/lang/de_de.json
index 57c2c1c8a..0b55e9023 100644
--- a/crates/horizon-client/assets/horizon/lang/de_de.json
+++ b/crates/horizon-client/assets/horizon/lang/de_de.json
@@ -146,10 +146,7 @@
"%s per frame": "%s pro Bild",
"%s MiB/frame": "%s MiB/Bild",
"%s KiB/frame": "%s KiB/Bild",
- "%s nits": "%s Nits",
"Auto (%s)": "Auto (%s)",
- "Auto (%s nits)": "Auto (%s Nits)",
- "%.2f nits": "%.2f Nits",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Gelände mit vollen Details. Die LOD-Entfernung reicht weiter.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Grobes fernes Gelände in lokalen Welten. Integrierte GPUs: max. 128.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Reduziert: fernes Gelände gröber, schneller auf dieser GPU.",
diff --git a/crates/horizon-client/assets/horizon/lang/en_us.json b/crates/horizon-client/assets/horizon/lang/en_us.json
index bdd8bc82a..c487e6cf4 100644
--- a/crates/horizon-client/assets/horizon/lang/en_us.json
+++ b/crates/horizon-client/assets/horizon/lang/en_us.json
@@ -150,10 +150,7 @@
"%s per frame": "%s per frame",
"%s MiB/frame": "%s MiB/frame",
"%s KiB/frame": "%s KiB/frame",
- "%s nits": "%s nits",
"Auto (%s)": "Auto (%s)",
- "Auto (%s nits)": "Auto (%s nits)",
- "%.2f nits": "%.2f nits",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Full-detail terrain range. LOD Distance can extend local worlds farther.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Reduced draws far terrain coarser: faster on this integrated GPU.",
diff --git a/crates/horizon-client/assets/horizon/lang/es_es.json b/crates/horizon-client/assets/horizon/lang/es_es.json
index 9fd06db71..1f6201972 100644
--- a/crates/horizon-client/assets/horizon/lang/es_es.json
+++ b/crates/horizon-client/assets/horizon/lang/es_es.json
@@ -140,10 +140,7 @@
"%s per frame": "%s por fotograma",
"%s MiB/frame": "%s MiB/fotograma",
"%s KiB/frame": "%s KiB/fotograma",
- "%s nits": "%s nits",
"Auto (%s)": "Automático (%s)",
- "Auto (%s nits)": "Automático (%s nits)",
- "%.2f nits": "%.2f nits",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Alcance del terreno con todo el detalle. La distancia LOD puede extender más los mundos locales.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Terreno lejano de baja resolución en mundos locales. Las GPU integradas se limitan a 128 chunks.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Reducido dibuja el terreno lejano con menos detalle: más rápido en esta GPU integrada.",
diff --git a/crates/horizon-client/assets/horizon/lang/fr_fr.json b/crates/horizon-client/assets/horizon/lang/fr_fr.json
index 56bedd872..73ae27e49 100644
--- a/crates/horizon-client/assets/horizon/lang/fr_fr.json
+++ b/crates/horizon-client/assets/horizon/lang/fr_fr.json
@@ -146,10 +146,7 @@
"%s per frame": "%s par image",
"%s MiB/frame": "%s MiB/image",
"%s KiB/frame": "%s KiB/image",
- "%s nits": "%s nits",
"Auto (%s)": "Auto (%s)",
- "Auto (%s nits)": "Auto (%s nits)",
- "%.2f nits": "%.2f nits",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Terrain en détail complet. La distance LOD va plus loin.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Terrain lointain simplifié, mondes locaux. GPU intégrés : 128 max.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Réduit : terrain lointain simplifié, plus rapide sur ce GPU.",
diff --git a/crates/horizon-client/assets/horizon/lang/pl_pl.json b/crates/horizon-client/assets/horizon/lang/pl_pl.json
index b20b4e9fb..041dc0945 100644
--- a/crates/horizon-client/assets/horizon/lang/pl_pl.json
+++ b/crates/horizon-client/assets/horizon/lang/pl_pl.json
@@ -146,10 +146,7 @@
"%s per frame": "%s na klatkę",
"%s MiB/frame": "%s MiB/klatka",
"%s KiB/frame": "%s KiB/klatka",
- "%s nits": "%s nitów",
"Auto (%s)": "Auto (%s)",
- "Auto (%s nits)": "Auto (%s nitów)",
- "%.2f nits": "%.2f nitów",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Zasięg terenu w pełnych szczegółach. Zasięg LOD sięga dalej.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Uproszczony odległy teren w światach lokalnych. Zintegr. GPU: do 128.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Ograniczone: odległy teren rysowany prościej, szybciej na tym GPU.",
diff --git a/crates/horizon-client/assets/horizon/lang/ru_ru.json b/crates/horizon-client/assets/horizon/lang/ru_ru.json
index 2f92bac71..d17ff3ba2 100644
--- a/crates/horizon-client/assets/horizon/lang/ru_ru.json
+++ b/crates/horizon-client/assets/horizon/lang/ru_ru.json
@@ -139,10 +139,7 @@
"%s per frame": "%s за кадр",
"%s MiB/frame": "%s МиБ/кадр",
"%s KiB/frame": "%s КиБ/кадр",
- "%s nits": "%s нит",
"Auto (%s)": "Авто (%s)",
- "Auto (%s nits)": "Авто (%s нит)",
- "%.2f nits": "%.2f нит",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Дальность прорисованного рельефа в деталях. Дистанция LOD может продлить её для локальных миров.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Грубый дальний рельеф в локальных мирах. На встроенной графике — не дальше 128 чанков.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "«Снижено» рисует дальний рельеф грубее: на этой встроенной видеокарте быстрее.",
diff --git a/crates/horizon-client/assets/horizon/lang/tr_tr.json b/crates/horizon-client/assets/horizon/lang/tr_tr.json
index 8034c7898..21aac401c 100644
--- a/crates/horizon-client/assets/horizon/lang/tr_tr.json
+++ b/crates/horizon-client/assets/horizon/lang/tr_tr.json
@@ -140,10 +140,7 @@
"%s per frame": "Kare başına %s",
"%s MiB/frame": "Kare başına %s MiB",
"%s KiB/frame": "Kare başına %s KiB",
- "%s nits": "%s nit",
"Auto (%s)": "Otomatik (%s)",
- "Auto (%s nits)": "Otomatik (%s nit)",
- "%.2f nits": "%.2f nit",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Arazinin tam ayrıntıyla görüntülendiği mesafe. LOD Mesafesi, yerel dünyalarda bu mesafeyi daha da artırabilir.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Yerel dünyalarda uzaktaki arazileri daha düşük ayrıntıyla görüntüler. Tümleşik GPU'larda sınır 128 parçadır.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Düşük ayarı, uzak arazileri daha düşük ayrıntıyla görüntüler. Bu tümleşik GPU'da daha yüksek performans sağlar.",
diff --git a/crates/horizon-client/assets/horizon/lang/uk_ua.json b/crates/horizon-client/assets/horizon/lang/uk_ua.json
index 8362fd154..00e340db6 100644
--- a/crates/horizon-client/assets/horizon/lang/uk_ua.json
+++ b/crates/horizon-client/assets/horizon/lang/uk_ua.json
@@ -146,10 +146,7 @@
"%s per frame": "%s на кадр",
"%s MiB/frame": "%s MiB/кадр",
"%s KiB/frame": "%s KiB/кадр",
- "%s nits": "%s ніт",
"Auto (%s)": "Авто (%s)",
- "Auto (%s nits)": "Авто (%s ніт)",
- "%.2f nits": "%.2f ніт",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "Дальність повних деталей. Дальність LOD сягає далі.",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "Спрощена далека місцевість локальних світів. Інтегр. GPU: до 128.",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "Знижена: далека місцевість простіша, швидше на цьому GPU.",
diff --git a/crates/horizon-client/assets/horizon/lang/zh_cn.json b/crates/horizon-client/assets/horizon/lang/zh_cn.json
index 15ac07583..20a557a43 100644
--- a/crates/horizon-client/assets/horizon/lang/zh_cn.json
+++ b/crates/horizon-client/assets/horizon/lang/zh_cn.json
@@ -140,10 +140,7 @@
"%s per frame": "每帧 %s",
"%s MiB/frame": "每帧 %s MiB",
"%s KiB/frame": "每帧 %s KiB",
- "%s nits": "%s 尼特",
"Auto (%s)": "自动(%s)",
- "Auto (%s nits)": "自动(%s 尼特)",
- "%.2f nits": "%.2f 尼特",
"Full-detail terrain range. LOD Distance can extend local worlds farther.": "完整细节的地形范围。LOD 距离可以让本地世界延伸得更远。",
"Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks.": "本地世界的远景粗略地形。集成显卡最多 128 个区块。",
"Reduced draws far terrain coarser: faster on this integrated GPU.": "“精简”把远景画得更粗略:在这块集成显卡上更快。",
diff --git a/crates/horizon-client/src/game/options.rs b/crates/horizon-client/src/game/options.rs
index 70b943f6c..1d3f9ec52 100644
--- a/crates/horizon-client/src/game/options.rs
+++ b/crates/horizon-client/src/game/options.rs
@@ -478,7 +478,7 @@ impl Game<'_> {
s.horizon.hdr,
s.horizon.paper_white_nits() as f32,
s.horizon.peak_nits() as f32,
- s.horizon.hdr_black_level as f32 / 100.0,
+ s.horizon.black_level_nits(),
s.horizon.hdr_ui_brightness as f32 / 100.0,
&Self::options_path().with_file_name(horizon_client::graphics::HDR_MARKER),
);
diff --git a/crates/horizon-client/src/game/tweaks.rs b/crates/horizon-client/src/game/tweaks.rs
index 2d493e833..78321fdb0 100644
--- a/crates/horizon-client/src/game/tweaks.rs
+++ b/crates/horizon-client/src/game/tweaks.rs
@@ -459,19 +459,15 @@ impl Game<'_> {
}
fn hdr_input(&mut self, name: &str) -> bool {
if self.screen != Screen::Playing
+ || self.title.is_some()
|| self.settings.horizon.hdr_key != name
|| !horizon_client::graphics::hdr_offered()
{
return false;
}
- if self.title.is_none() {
- self.capture(false);
- }
- self.open_options_at(
- self.title.is_some(),
- horizon_client::options_ui::Page::GraphicsHdr,
- );
- self.options_to_game = self.title.is_none();
+ self.capture(false);
+ self.open_options_at(false, horizon_client::options_ui::Page::GraphicsHdr);
+ self.options_to_game = true;
true
}
fn sort_input(&mut self, name: &str) -> bool {
diff --git a/docs/graphics.md b/docs/graphics.md
index d6178d012..3c29dfef1 100644
--- a/docs/graphics.md
+++ b/docs/graphics.md
@@ -35,7 +35,7 @@ Every row has a one-line description and its cost in frame time (none, low, medi
**Translucent batching** (only in the file for now: `translucentBatching` in `horizon-graphics.txt`, off by default; edit it with the game closed, it applies at the next start) gives water, glass, ice and other translucent quads a vertex buffer of their own, with pages up to 2 GiB, and their sorted indices the same: the back-to-front list then stays in one page and goes out in a few draw calls instead of switching pages every few sections. The picture is the same; it costs a little video memory, as solid and translucent quads no longer share free space. The large pages shrink once the view has settled (a second after terrain stops arriving): one much larger than what it holds, as after a teleport or a lower render distance, moves into a page of the right size, about 32 MiB a frame. It needs indirect multi-draw that isn't OpenGL's (which loops over the entries on the CPU), and devices whose vanilla frames draw flat (Metal, Intel Gen11 and Gen12 on Vulkan) don't offer it. A `shaders/` pack's terrain and shadow passes, and the `[shadow]` pass of one of Horizon's own packs, draw flat where the device can, reading translucent quads beside their section's solid ones: while such a pack runs they go back there. Such a pack picked at the start has the world laid out for it from the first; switching to or from one later meshes the world again.
-**HDR** (off by default) lives on its own screen, Graphics: HDR, behind **HDR Settings...** under Display, which is greyed where the display path offers no HDR output (so players without an HDR display don't take its settings for their display's); there the switch comes first and the sliders below it only while it is on. It presents to an HDR10 swapchain (`Rgb10a2Unorm`, BT.2020 with the PQ curve) or, where only that is offered, an scRGB one (`Rgba16Float`, extended linear sRGB), on displays and compositors that offer either; `HORIZON_HDR_OUTPUT=pq` or `scrgb` allows only one. The frame is drawn exactly as in SDR, in vanilla's gamma space, and a last pass (`hdr.wgsl`) decodes it to linear light at the **Paper White** and lifts light sources (blocks that emit light, lava, the sun and the moon) towards the **Peak Brightness**; everything else stays as in SDR. The mesher puts the light a block's face emits in its vertex colour's alpha (`EMISSION_BITS`), the frame's alpha carries the mark, and only pixels that still show the world before the hand and HUD are lifted. On Vulkan, `horizon-hdr` sends HDR metadata (MaxCLL, mastering luminance), which wgpu doesn't: without it a compositor may clip everything above SDR white. Paper White and Peak Brightness are **Auto** by default: they follow what the system reports for the display. On Wayland that's the compositor's preferred image description of the window (`wp_color_management_v1`, in `horizon-hdr`'s `wayland.rs`), asked and then watched while HDR output is on (with HDR off the game doesn't ask), so a move to another output or a recalibrated desktop applies at once. KWin maps the content's reference white (203 nits) onto the desktop's SDR white, so Auto puts Paper White at 203 and Peak Brightness at the display's peak over that ratio; Hyprland (0.57) doesn't: it reports the standard 203 as reference white, so Auto puts Paper White at 203, and it shows HDR windows below its own SDR white (`sdr_max_luminance`, which it doesn't report): in a test, a white browser page was brighter than both the game's white and a 1000-nit patch in mpv. Other compositors are unchecked. On Windows Auto takes what wgpu reads from the OS (`Surface::display_hdr_info`: DXGI's `MaxLuminance` and the SDR white level of Windows' SDR content brightness slider, both absolute nits), read again every 2 seconds since no event says they changed; these often come from the display's EDID and may run optimistic, and this is untested so far. **Calibrate...** (`hdr_calibration.rs`) sets Black Level, Peak Brightness and Paper White full screen, one test picture at a time, drawn by the last pass straight in nits above a band of controls: Horizon's logo at the slider on black, lowered until it disappears; the logo at the slider inside a tenth of the screen at 10 000 nits (small, so the display doesn't dim), raised until it disappears; a white card, set to a white that's comfortable in the light the player plays in. Save writes the three, Cancel or Escape keeps what was set, and a step left untouched keeps Auto. The Peak step needs a path that doesn't tone-map: on KWin the logo never disappears, so where the system reports its values the button reads **Calibrate Anyway...** and says the display is already set up (**Use Automatic Setup** once they were changed by hand). Where nothing is reported, Auto is 203 and 1000 nits, and the Graphics: HDR screen asks the player to calibrate. **Black Level** (0 by default, for an OLED's true black) is the display's darkest black, in nits: the last pass lifts the shadows onto it with ITU-R BT.2390's black level lift in PQ, which leaves the peak where it is and fades out by the fourth power above black, and the metadata gives it as the minimum luminance; at 0 the picture is unchanged. **UI Brightness** (100% by default) sets the HUD and menus against paper white: once the world is kept for the last pass, the frame's alpha is zeroed, everything drawn after raises it where it covers the world, the first-person hand's is then scaled down to 1/255 (it stays at the world's brightness), and the last pass scales the rest by UI Brightness and lifts none of it (so text over the sun stays text). With HDR on, F2 writes vanilla's screenshot as always and an HDR10 copy beside it (`…-hdr.png`): the HDR pass drawn once more into a 10-bit PQ target, whatever the swapchain is, saved as a 16-bit PNG tagged BT.2020 with PQ (`cICP`, PNG's third edition) and the peak and paper white as content light levels (`cLLI`); viewers that read `cICP` show it in HDR, and others that honour its ICC profile (reference white at the profile's white) a correct SDR picture with clipped highlights. Not lifted yet: translucent blocks (the nether portal), distant LOD terrain.
+**HDR** (off by default) lives on its own screen, Graphics: HDR, behind **HDR Settings...** under Display, which is greyed where the display path offers no HDR output (so players without an HDR display don't take its settings for their display's); there the switch comes first and the sliders below it only while it is on. It presents to an HDR10 swapchain (`Rgb10a2Unorm`, BT.2020 with the PQ curve) or, where only that is offered, an scRGB one (`Rgba16Float`, extended linear sRGB), on displays and compositors that offer either; `HORIZON_HDR_OUTPUT=pq` or `scrgb` allows only one. The frame is drawn exactly as in SDR, in vanilla's gamma space, and a last pass (`hdr.wgsl`) decodes it to linear light at the **Paper White** and lifts light sources (blocks that emit light, lava, the sun and the moon) towards the **Peak Brightness**; everything else stays as in SDR. The mesher puts the light a block's face emits in its vertex colour's alpha (`EMISSION_BITS`), the frame's alpha carries the mark, and only pixels that still show the world before the hand and HUD are lifted. On Vulkan, `horizon-hdr` sends HDR metadata (MaxCLL, mastering luminance), which wgpu doesn't: without it a compositor may clip everything above SDR white. Paper White and Peak Brightness are **Auto** by default: they follow what the system reports for the display. On Wayland that's the compositor's preferred image description of the window (`wp_color_management_v1`, in `horizon-hdr`'s `wayland.rs`), asked and then watched while HDR output is on (with HDR off the game doesn't ask), so a move to another output or a recalibrated desktop applies at once. KWin maps the content's reference white (203 nits) onto the desktop's SDR white, so Auto puts Paper White at 203 and Peak Brightness at the display's peak over that ratio; Hyprland (0.57) doesn't: it reports the standard 203 as reference white, so Auto puts Paper White at 203, and it shows HDR windows below its own SDR white (`sdr_max_luminance`, which it doesn't report): in a test, a white browser page was brighter than both the game's white and a 1000-nit patch in mpv. Other compositors are unchecked. On Windows Auto takes what wgpu reads from the OS (`Surface::display_hdr_info`: DXGI's `MaxLuminance` and the SDR white level of Windows' SDR content brightness slider, both absolute nits), read again every 2 seconds since no event says they changed; these often come from the display's EDID and may run optimistic, and this is untested so far. **Calibrate...** (`hdr_calibration.rs`) sets Black Level, Peak Brightness and Paper White full screen, one test picture at a time, drawn by the last pass straight in nits above a band of controls: Horizon's logo at the slider on black, lowered until it disappears; the logo at the slider inside a tenth of the screen at 10 000 nits (small, so the display doesn't dim), raised until it disappears; a white card, set to a white that's comfortable in the light the player plays in. Save writes the three, Cancel or Escape keeps what was set, and a step left untouched keeps Auto. The Peak step needs a path that doesn't tone-map: on KWin the logo never disappears, so where the system reports its values the button reads **Calibrate Anyway...** and says the display is already set up (**Use Automatic Setup** once they were changed by hand). Where nothing is reported, Auto is 203 and 1000 nits, and the Graphics: HDR screen asks the player to calibrate. **Black Level** (0 is Auto: what the system reports, else an OLED's true black) is the display's darkest black, in nits: the last pass lifts the shadows onto it with ITU-R BT.2390's black level lift in PQ, which leaves the peak where it is and fades out by the fourth power above black, and the metadata gives it as the minimum luminance; at 0 the picture is unchanged. **UI Brightness** (100% by default) sets the HUD and menus against paper white: once the world is kept for the last pass, the frame's alpha is zeroed, everything drawn after raises it where it covers the world, the first-person hand's is then scaled down to 1/255 (it stays at the world's brightness), and the last pass scales the rest by UI Brightness and lifts none of it (so text over the sun stays text). With HDR on, F2 writes vanilla's screenshot as always and an HDR10 copy beside it (`…-hdr.png`): the HDR pass drawn once more into a 10-bit PQ target, whatever the swapchain is, saved as a 16-bit PNG tagged BT.2020 with PQ (`cICP`, PNG's third edition) and the peak and paper white as content light levels (`cLLI`); viewers that read `cICP` show it in HDR, and others that honour its ICC profile (reference white at the profile's white) a correct SDR picture with clipped highlights. Not lifted yet: translucent blocks (the nether portal), distant LOD terrain. The screen shows these as plain numbers: they are nits only where the compositor passes PQ through unchanged (Windows, Hyprland with tone mapping off), not on KWin or macOS, and the game can't tell which.
HDR's light sources shine by the kind of light rather than its level (`mesher::hdr_tier`): the sun most, then glowstone, campfires and the soul fires, then flames and lava, torch and candle flames among them (particles too), then faint glowers such as a redstone torch or magma; glow lichen stays as in SDR. Each tier has its share of the headroom and the brightness its lift starts and ends at, the texel's own before lighting, so a light source shines alike at any light level and on every face (`gfx/hdr.rs` `TIERS`); `HORIZON_HDR_DEBUG=1` greys what isn't lifted and tints what is magenta.