## H14: flat ground, a boulder and a post under Look's environment and sun. With ## `force_shadows`, the sun casts shadows even where Look.sun_shadows_supported says the ## renderer gets them wrong, to recheck the Compatibility renderer after an engine ## upgrade: `CAPTURE_RENDERER=compatibility tools/capture.sh sun_shadow_probe out.png` ## shows pale sunlit ground for as long as the engine adds the shadowed sun in sRGB. ## Compare with the `sun_probe` scenario, the same scene without the override. extends Node3D @export var force_shadows: bool = false func _ready() -> void: var world: WorldEnvironment = WorldEnvironment.new() world.environment = Look.environment() add_child(world) var sun: DirectionalLight3D = Look.sun(200.0) if force_shadows: sun.shadow_enabled = true add_child(sun) var plane: PlaneMesh = PlaneMesh.new() plane.size = Vector2(80.0, 80.0) _mesh(plane, Vector3.ZERO, Color(0.31, 0.42, 0.22)) var rock: SphereMesh = SphereMesh.new() rock.radius = 1.5 rock.height = 2.4 _mesh(rock, Vector3(-2.0, 0.8, 2.0), Color(0.47, 0.44, 0.39)) var post: BoxMesh = BoxMesh.new() post.size = Vector3(0.6, 4.0, 0.6) _mesh(post, Vector3(3.0, 2.0, 4.0), Color(0.55, 0.36, 0.22)) var camera: Camera3D = Camera3D.new() camera.position = Vector3(0.0, 5.0, -10.0) add_child(camera) camera.look_at(Vector3(0.0, 0.0, 4.0)) camera.make_current() func _mesh(mesh: Mesh, at: Vector3, colour: Color) -> void: var material: StandardMaterial3D = StandardMaterial3D.new() material.albedo_color = colour material.roughness = 1.0 material.metallic_specular = 0.15 var instance: MeshInstance3D = MeshInstance3D.new() instance.mesh = mesh instance.material_override = material instance.position = at add_child(instance)