H2: Graphics presets, OpenGL fallback notice, tested configurations
Presets now tune shadows, cascades, render scale and anti-aliasing: Low (no shadows, 75%, FXAA), Medium (200 m, 2 cascades, FXAA), High (400 m, 4 cascades, MSAA 2x). GameSettings.apply_to_viewport sets the viewport; MatchView.apply_settings sets the sun's cascades. No preset changes how far props or pieces are drawn, so a lower one never shows a player through cover; a test guards it. When Vulkan can't start, Godot falls back to OpenGL (fallback_to_opengl3) and RendererCheck has the main menu say so. tools/capture.sh gains CAPTURE_RENDERER=no_vulkan, which hides the Vulkan driver and expects the fallback. New scenarios quality_low/medium/high draw a match moment with each preset, reviewed in both renderers. docs/PLAY.md lists the presets, renderers, Wayland and hybrid-GPU notes, and the tested configurations, marking each as software-rendered only or not tested. Closes #55 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,16 +8,23 @@ extends RefCounted
|
||||
|
||||
const DEFAULT_PATH: String = InputSettings.DEFAULT_PATH
|
||||
|
||||
## Graphics quality presets (H2 tunes what each does).
|
||||
## Graphics quality presets (H2; documented in docs/PLAY.md).
|
||||
const QUALITY_NAMES: Array[String] = ["Low", "Medium", "High"]
|
||||
const QUALITY_LOW: int = 0
|
||||
const QUALITY_MEDIUM: int = 1
|
||||
const QUALITY_HIGH: int = 2
|
||||
## Per preset: sun shadow distance in metres (0 = no shadows) and 3D render scale.
|
||||
## Per preset:
|
||||
## shadow_distance how far the sun casts shadows, in metres (0 = no shadows)
|
||||
## shadow_splits the sun's shadow cascades: 1, 2 or 4
|
||||
## render_scale the 3D resolution against the window's
|
||||
## msaa multisample anti-aliasing (a Viewport.MSAA_ value)
|
||||
## fxaa the cheap screen-space anti-aliasing, for presets without MSAA
|
||||
## Nothing here changes what can be seen: trees, rocks and pieces are drawn as far on
|
||||
## every preset, so a lower one never shows a player through cover.
|
||||
const QUALITY: Array[Dictionary] = [
|
||||
{"shadow_distance": 0.0, "render_scale": 0.75},
|
||||
{"shadow_distance": 200.0, "render_scale": 1.0},
|
||||
{"shadow_distance": 400.0, "render_scale": 1.0},
|
||||
{"shadow_distance": 0.0, "shadow_splits": 1, "render_scale": 0.75, "msaa": Viewport.MSAA_DISABLED, "fxaa": true},
|
||||
{"shadow_distance": 200.0, "shadow_splits": 2, "render_scale": 1.0, "msaa": Viewport.MSAA_DISABLED, "fxaa": true},
|
||||
{"shadow_distance": 400.0, "shadow_splits": 4, "render_scale": 1.0, "msaa": Viewport.MSAA_2X, "fxaa": false},
|
||||
]
|
||||
const WINDOW_MODES: Array[String] = ["Windowed", "Fullscreen", "Exclusive fullscreen"]
|
||||
## Frame caps offered, 0 for none.
|
||||
@@ -73,6 +80,19 @@ func render_scale() -> float:
|
||||
return float(QUALITY[quality]["render_scale"])
|
||||
|
||||
|
||||
func shadow_splits() -> int:
|
||||
return int(QUALITY[quality]["shadow_splits"])
|
||||
|
||||
|
||||
## Render scale and anti-aliasing on the viewport the match is drawn in.
|
||||
func apply_to_viewport(viewport: Viewport) -> void:
|
||||
if viewport == null:
|
||||
return
|
||||
viewport.scaling_3d_scale = render_scale()
|
||||
viewport.msaa_3d = QUALITY[quality]["msaa"]
|
||||
viewport.screen_space_aa = Viewport.SCREEN_SPACE_AA_FXAA if QUALITY[quality]["fxaa"] else Viewport.SCREEN_SPACE_AA_DISABLED
|
||||
|
||||
|
||||
func save(path: String = DEFAULT_PATH) -> Error:
|
||||
var config: ConfigFile = ConfigFile.new()
|
||||
# The mouse keeps its own section, as InputSettings has always saved it.
|
||||
@@ -133,8 +153,8 @@ func apply_to_program(tree: SceneTree) -> void:
|
||||
var modes: Array[DisplayServer.WindowMode] = [DisplayServer.WINDOW_MODE_WINDOWED, DisplayServer.WINDOW_MODE_FULLSCREEN, DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN]
|
||||
if DisplayServer.window_get_mode() != modes[window_mode]:
|
||||
DisplayServer.window_set_mode(modes[window_mode])
|
||||
if tree != null and tree.root != null:
|
||||
tree.root.scaling_3d_scale = render_scale()
|
||||
if tree != null:
|
||||
apply_to_viewport(tree.root)
|
||||
|
||||
|
||||
## Sets the Master bus, and the Music and Effects buses, making them if they aren't
|
||||
|
||||
@@ -30,6 +30,8 @@ func apply_settings(settings: GameSettings) -> void:
|
||||
if sun != null:
|
||||
sun.shadow_enabled = distance > 0.0
|
||||
sun.directional_shadow_max_distance = maxf(distance, 1.0)
|
||||
var splits: Dictionary = {1: DirectionalLight3D.SHADOW_ORTHOGONAL, 2: DirectionalLight3D.SHADOW_PARALLEL_2_SPLITS, 4: DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS}
|
||||
sun.directional_shadow_mode = splits.get(settings.shadow_splits(), DirectionalLight3D.SHADOW_PARALLEL_4_SPLITS)
|
||||
if print_pass != null:
|
||||
print_pass.visible = settings.print_pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user