feat: scene lighting — angled sun, procedural sky, ambient (terrain-water task 16)

The debug scene had one DirectionalLight3D at identity rotation (shining
horizontally along -Z), no sky, and ambient sourced from the background,
which with no sky is the flat clear colour. Terrain read flat, shadowed
faces crushed, nothing to reflect. We have been judging terrain and water
against that -- a bad-evidence trap.

Minimal and standard, nothing else:
  * sun angled to 52 deg elevation, shadows ENABLED, shadow max distance
    2500 m (the default 100 m is useless at this world scale)
  * WorldEnvironment gains a ProceduralSkyMaterial sky, background_mode Sky
  * ambient sourced from that sky at 0.45 energy, so shadow sides read
No post-fx, no volumetrics, no SSAO, no tonemap change -- renderer-chat work.

MEASURED on seed 1280587109, identical camera, before vs after (mean region
colour off the rendered frames):

  land      luma  36 -> 122
  mountain  luma  76 -> 188, blue-excess -0.3 -> +49.7  (snow now reads as
            lit snow catching sky, not flat grey)

TERRAIN JUDGEABILITY IS THE WIN, and it is large.

BUT THE TASK'S PREMISE DID NOT HOLD, and it should not be quietly buried:
"the sky is what fixes the [water] grey, not re-tuning the water" -- it
does not. Same measurement, water region:

  water     luma  61 -> 116, blue-excess -3.7 -> -6.2   (BRIGHTER, and
            LESS blue -- it reads as bright grey-brown, not as water)

Mechanism: the water material is non-metallic at roughness 0.35 with
VertexColorUseAsAlbedo and alpha 0.62 in the shallows. A rough dielectric
barely shows a sky reflection; what you actually see is ~62 % water tint
over ~38 % seabed, and the seabed is exactly what the new ambient just
brightened. Lighting the world lights what shows THROUGH the water more
than it lights the water.

The fix is a water-material dial -- WATER_ALPHA_SHALLOW/DEEP, or giving the
surface enough specular to return the new sky -- and this task is forbidden
from touching task 13's material, correctly, since that is a separate
judgement. Left for the developer; reported rather than silently worked
around.

The camera's colinear LookAt warning is UNCHANGED and still present. It
comes from cam.LookAt() pointing straight down in ServerChunkManager, not
from the light, so angling the sun could never have cleared it. Verified.

Scene file only -- no code changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stewart Howe 2026-08-10 02:10:03 -04:00
parent b9c7675e78
commit 34b0e1c9e3

View file

@ -2,13 +2,34 @@
[ext_resource type="Script" uid="uid://c1dxqbgohxr6k" path="res://Server/Scripts/ServerChunkManager.cs" id="1_r150o"] [ext_resource type="Script" uid="uid://c1dxqbgohxr6k" path="res://Server/Scripts/ServerChunkManager.cs" id="1_r150o"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_sky0"]
sky_top_color = Color(0.28, 0.47, 0.79, 1)
sky_horizon_color = Color(0.72, 0.8, 0.86, 1)
sky_curve = 0.12
ground_bottom_color = Color(0.16, 0.15, 0.14, 1)
ground_horizon_color = Color(0.58, 0.56, 0.5, 1)
ground_curve = 0.05
sun_angle_max = 12.0
sun_curve = 0.15
[sub_resource type="Sky" id="Sky_main0"]
sky_material = SubResource("ProceduralSkyMaterial_sky0")
[sub_resource type="Environment" id="Environment_r150o"] [sub_resource type="Environment" id="Environment_r150o"]
background_mode = 2
sky = SubResource("Sky_main0")
ambient_light_source = 3
ambient_light_color = Color(0.37245482, 0.5677467, 1, 1) ambient_light_color = Color(0.37245482, 0.5677467, 1, 1)
ambient_light_energy = 0.45
[node name="World" type="Node3D" unique_id=412138339] [node name="World" type="Node3D" unique_id=412138339]
script = ExtResource("1_r150o") script = ExtResource("1_r150o")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1569534216] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1569534216]
transform = Transform3D(-0.7071068, 0, 0.7071068, 0.5572077, 0.6156615, 0.5572077, -0.4353384, 0.7880108, -0.4353384, 0, 0, 0)
light_energy = 1.0
shadow_enabled = true
directional_shadow_max_distance = 2500.0
[node name="Camera3D" type="Camera3D" parent="." unique_id=1064925728] [node name="Camera3D" type="Camera3D" parent="." unique_id=1064925728]
transform = Transform3D(1, 0, 0, 0, 0.49999997, -0.86602545, 0, 0.86602545, 0.49999997, 2559.9224, 640.90497, -171.46881) transform = Transform3D(1, 0, 0, 0, 0.49999997, -0.86602545, 0, 0.86602545, 0.49999997, 2559.9224, 640.90497, -171.46881)