From a197adaed09eb0945cb5d84fb4f38bff5f698807 Mon Sep 17 00:00:00 2001 From: Ludovic Marie <136255825+ludovic111@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:19:43 +0200 Subject: [PATCH] Video settings: cost labels from measured frame times, and "Saves time" for cave culling Measured on an Intel HD 620 (#897): rain and snow cost about 3 ms of GPU per frame there, most of it from the weather radius; FXAA about 0.8 ms; cave culling saves about 0.6 ms; mipmaps cost nothing measurable and clouds about 0.1 ms. A new Cost::Saves tag ("Saves time", in the success colour) marks a setting that makes frames faster when on. Co-Authored-By: Claude Opus 5.5 --- crates/horizon-client/src/graphics_style.rs | 21 ++++++++++++++++++++- crates/horizon-client/src/graphics_ui.rs | 12 ++++++------ crates/horizon-client/src/ui_theme.rs | 13 ++++++++++--- docs/graphics.md | 2 +- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/crates/horizon-client/src/graphics_style.rs b/crates/horizon-client/src/graphics_style.rs index 45bd3db06..e02a0e1d9 100644 --- a/crates/horizon-client/src/graphics_style.rs +++ b/crates/horizon-client/src/graphics_style.rs @@ -14,6 +14,8 @@ pub enum Cost { Low, Medium, High, + /// Turning it on makes frames faster (culling). + Saves, } impl Cost { pub fn label(self) -> &'static str { @@ -22,6 +24,7 @@ impl Cost { Cost::Low => "Low cost", Cost::Medium => "Medium cost", Cost::High => "High cost", + Cost::Saves => "Saves time", } } } @@ -42,7 +45,7 @@ pub struct Style { pub header_color: u32, pub description_color: u32, /// Colour of each `Cost`, in its order. - pub cost_colors: [u32; 4], + pub cost_colors: [u32; 5], } /// `hud::rgba` with full alpha, usable in constants. @@ -65,6 +68,7 @@ pub const STYLE: Style = Style { opaque(170, 220, 120), opaque(240, 200, 90), opaque(240, 110, 90), + opaque(85, 255, 85), ], }; @@ -179,3 +183,18 @@ fn wrap(atlas: &HudAtlas, text: &str, width: f32, indent: f32) -> Vec { } lines } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn every_cost_has_a_label_and_a_colour() { + let all = [Cost::None, Cost::Low, Cost::Medium, Cost::High, Cost::Saves]; + assert_eq!(all.len(), STYLE.cost_colors.len()); + for (i, cost) in all.into_iter().enumerate() { + assert_eq!(cost as usize, i); + assert!(!cost.label().is_empty()); + } + } +} diff --git a/crates/horizon-client/src/graphics_ui.rs b/crates/horizon-client/src/graphics_ui.rs index ea126c785..eea2d03cb 100644 --- a/crates/horizon-client/src/graphics_ui.rs +++ b/crates/horizon-client/src/graphics_ui.rs @@ -124,7 +124,7 @@ pub fn rows(level: Level) -> Vec { ), h( H::CaveCulling, - None, + Saves, "Skips terrain hidden behind closed sections. Off costs a lot.", ), h( @@ -150,7 +150,7 @@ pub fn rows(level: Level) -> Vec { ), v( Opt::Mipmaps, - Low, + None, "Smaller copies of block textures for distant terrain: less shimmer.", ), v( @@ -160,7 +160,7 @@ pub fn rows(level: Level) -> Vec { ), v( Opt::Clouds, - Medium, + Low, "Cloud layer: off, flat (fast) or 3D (fancy).", ), v(Opt::CloudRange, Low, "How far clouds reach, in chunks."), @@ -170,10 +170,10 @@ pub fn rows(level: Level) -> Vec { None, "Distance fog. Off shows the edge of the loaded world.", ), - h(H::Weather, Low, "Draws rain and snow."), + h(H::Weather, High, "Draws rain and snow."), v( Opt::WeatherRadius, - Low, + Medium, "How far rain and snow fall around you.", ), v(Opt::Particles, Medium, "How many particles effects spawn."), @@ -213,7 +213,7 @@ pub fn rows(level: Level) -> Vec { ), h( H::Antialiasing, - Low, + Medium, "FXAA smooths jagged edges of the world; slightly softer image.", ), h( diff --git a/crates/horizon-client/src/ui_theme.rs b/crates/horizon-client/src/ui_theme.rs index 2c30bf219..d4244fa24 100644 --- a/crates/horizon-client/src/ui_theme.rs +++ b/crates/horizon-client/src/ui_theme.rs @@ -1247,7 +1247,8 @@ impl<'a> Ui<'a> { } /// A settings row with, under its label, a one-line description led by /// the setting's frame-time cost (`cost` 0 none .. 3 high, coloured from - /// the muted colour to the danger colour). Same height as [`Ui::row`]. + /// the muted colour to the danger colour; 4 saves time, in the success + /// colour). Same height as [`Ui::row`]. #[allow(clippy::too_many_arguments)] pub fn described_row( &mut self, @@ -1276,8 +1277,14 @@ impl<'a> Ui<'a> { &value, ); let dy = top + (BODY * 1.45).round(); - let tint = [0.0, 0.2, 0.55, 1.0][usize::from(cost.0.min(3))]; - let cost_color = color::mix(color::FAINT, color::DANGER, tint); + let cost_color = match cost.0 { + 4 => color::SUCCESS, + n => color::mix( + color::FAINT, + color::DANGER, + [0.0, 0.2, 0.55, 1.0][usize::from(n.min(3))], + ), + }; self.text(Face::Medium, SMALL, x, dy, cost_color, cost.1); // No cost label: the description starts at the row's edge. let used = if cost.1.is_empty() { diff --git a/docs/graphics.md b/docs/graphics.md index 0d3de5b1e..b1c3c0209 100644 --- a/docs/graphics.md +++ b/docs/graphics.md @@ -9,7 +9,7 @@ In the Horizon menu style, the Options screen's **Video** section holds the grap In the Classic style, Video Settings starts with two buttons opening the same settings as vanilla-looking screens. -Every row has a one-line description and its cost in frame time (none, low, medium, high), and applies at once, except worker threads, which apply at the next start. A preset sets the quality settings together; changing one of them turns it into Custom. Display preferences (FOV, framerate, VSync, GUI scale, fullscreen, present mode, pacing) leave the preset as it is. +Every row has a one-line description and its cost in frame time (none, low, medium, high, or saves time for culling that makes frames faster), and applies at once, except worker threads, which apply at the next start. A preset sets the quality settings together; changing one of them turns it into Custom. Display preferences (FOV, framerate, VSync, GUI scale, fullscreen, present mode, pacing) leave the preset as it is. ![Simple](media/settings-simple.png) ![Advanced](media/settings-advanced.png)