H14: No sun shadows under the OpenGL fallback

Godot's Compatibility renderer draws a shadowed directional light in a
pass of its own and adds it after the frame is in sRGB, so sunlit pixels
come out as srgb(ambient) + srgb(sun) (measured to within 1/255 on
llvmpipe) and ground and rocks wash out. No environment or project
setting avoids it, so Look.sun_shadows_supported() is false under
gl_compatibility and the sun casts no shadows there on any preset.

Adds the sun_probe and sun_shadow_probe capture scenarios to recheck
after an engine upgrade, a test, and the explanation in PLAY.md and the
README.

Closes #81

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 20:28:31 -05:00
co-authored by Claude Opus 5.5
parent 358234d246
commit 8710c099b3
9 changed files with 106 additions and 8 deletions
+2 -1
View File
@@ -27,10 +27,11 @@ var effects: EffectsView
## Applies the player's graphics settings: the sun's shadows and the print pass.
## Under the OpenGL fallback the sun never casts shadows (Look.sun_shadows_supported).
func apply_settings(settings: GameSettings) -> void:
var distance: float = settings.shadow_distance()
if sun != null:
sun.shadow_enabled = distance > 0.0
sun.shadow_enabled = distance > 0.0 and Look.sun_shadows_supported()
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)
+14 -2
View File
@@ -40,16 +40,28 @@ static func environment(graded: bool = true) -> Environment:
return environment
## The low afternoon sun from the sea side.
## The low afternoon sun from the sea side. It casts shadows only where the renderer
## draws them correctly (sun_shadows_supported).
static func sun(shadow_distance: float = 400.0) -> DirectionalLight3D:
var light: DirectionalLight3D = DirectionalLight3D.new()
light.rotation_degrees = Vector3(-35.0, -130.0, 0.0)
light.light_energy = 0.95
light.shadow_enabled = true
light.shadow_enabled = sun_shadows_supported()
light.directional_shadow_max_distance = shadow_distance
return light
## Whether `rendering_method` draws the sun's shadows without changing the colours (H14).
## Godot's Compatibility renderer (the OpenGL fallback) draws a shadowed directional
## light in a pass of its own and adds it to the frame after the frame is already in
## sRGB, so a sunlit pixel comes out as srgb(ambient) + srgb(sun) instead of
## srgb(ambient + sun): sunlit ground and rocks turn pale. Measured on llvmpipe, the
## sum matches to within one level in 255. No project or environment setting changes
## it, so under that renderer the sun casts no shadows, as on the Low preset.
static func sun_shadows_supported(rendering_method: String = RenderingServer.get_current_rendering_method()) -> bool:
return rendering_method != "gl_compatibility"
## Adds the woodcut print pass to `camera`, as a full-screen quad drawn after
## everything else. Returns the quad, whose material takes `sea_level` (see
## set_sea_level) and `strength`.