build: baked lighting pass on kit_demo test map

Restructured kit_demo.tscn from linear demo to enclosed 5.12x5.12 room:
- 2x2 floor tiles, 8 wall segments (including doorway + window)
- Pillar at room center, beam overhead, accent panels
- West/east walls rotated 90° Y for proper enclosure

Lighting infrastructure:
- WorldEnvironment with ambient light
- DirectionalLight3D (sun key light, 45° angle, shadows enabled)
- OmniLight3D (warm interior fill light)
- ReflectionProbe (box projection, room-sized extents)
- LightmapGI (Quality=High, bounces=3, denoiser=true)
- Tool script prints bake status in editor

Scripts:
- bake_lighting.gd: validates LightmapGI config from CLI
- validate_scene.gd: full scene validation (17 checks, all pass)

Note: Godot 4.7 removed LightmapGI.bake() from runtime API.
Baking must be done in the editor: select LightmapGI node > Bake Lightmap.
This commit is contained in:
2026-07-01 00:28:55 -04:00
parent aa0b80b570
commit 16e062c739
4 changed files with 188 additions and 99 deletions
+24 -24
View File
@@ -1,44 +1,44 @@
@tool
extends Node3D
# Auto-bakes the LightmapGI when opened in the Godot editor.
# Only runs in editor mode — does nothing in exported builds.
#
# Manual bake:
# Open the scene in the Godot editor, select LightmapGI node,
# click "Bake Lightmap" in the inspector at the top of the node's properties.
# Provides baked lighting configuration guidance in the editor output panel.
# LightmapGI baking is editor-only in Godot 4.7 — use the Bake button.
#
# This script provides feedback in the editor Output panel.
@tool
# To bake:
# 1. Open this scene in the Godot editor
# 2. Select the LightmapGI node in the Scene dock
# 3. Click "Bake Lightmap" in the Inspector toolbar (top of inspector)
#
# Or: Scene menu > Bake LightmapGI (Ctrl+Shift+B)
func _ready():
if not Engine.is_editor_hint():
# Not in editor — nothing to do for runtime
return
# Check if we have a LightmapGI node
var lightmap = _find_lightmap_gi()
if not lightmap:
push_error("KitDemo: No LightmapGI node found in scene!")
return
# Check if already baked
if lightmap.light_data != null:
print("KitDemo: Lightmap already baked. To re-bake:")
print(" Select LightmapGI node → 'Bake Lightmap' button in Inspector")
print("KitDemo: Lightmap baked ✓")
print(" To re-bake: Select LightmapGI → 'Bake Lightmap' button")
return
# Not baked — offer to bake
print("KitDemo: LightmapGI found but not baked.")
print(" To bake: Select LightmapGI → click 'Bake Lightmap' at top of Inspector")
print(" Or right-click LightmapGI node → 'Bake Lightmap'")
print("KitDemo: LightmapGI configured but not baked.")
print(" To bake: Select LightmapGI → 'Bake Lightmap' in Inspector")
print(" Or: Scene menu → Bake LightmapGI (Ctrl+Shift+B)")
print("")
print(" LightmapGI settings:")
print(" Bounces: ", lightmap.bounces)
print(" Texel Scale: ", lightmap.texel_scale)
print(" Texel Subdiv: ", lightmap.texel_subdiv)
print(" Max Texture Size: ", lightmap.max_texture_size)
print(" Interior: ", lightmap.interior)
match lightmap.quality:
0: print(" Quality: Low")
1: print(" Quality: Medium")
2: print(" Quality: High")
3: print(" Quality: Ultra")
print(" Bounces: ", lightmap.bounces)
print(" Texel Scale: ", lightmap.texel_scale)
print(" Max Texture Size: ", lightmap.max_texture_size)
print(" Interior: ", lightmap.interior)
print(" Denoiser: ", lightmap.is_using_denoiser())
func _find_lightmap_gi() -> LightmapGI:
+8 -22
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=23 format=3]
[gd_scene load_steps=21 format=3]
; === External Resources (modular kit pieces) ===
[ext_resource type="PackedScene" path="res://assets/scenes/modular/wall_straight_01.tscn" id="1"]
@@ -24,27 +24,14 @@
; === Script ===
[ext_resource type="Script" path="res://assets/scenes/modular/kit_demo.gd" id="19"]
; === Subresources (Sky, Environment for WorldEnvironment) ===
[sub_resource type="ProceduralSkyMaterial" id="SkyMat"]
sky_top_color = Color(0.45, 0.55, 0.75)
sky_horizon_color = Color(0.65, 0.6, 0.8)
sky_bottom_color = Color(0.35, 0.35, 0.4)
ground_bottom_color = Color(0.15, 0.15, 0.15)
sky_energy_multiplier = 0.5
sky_exposure = 1.0
[sub_resource type="Sky" id="Sky"]
sky_material = SubResource("SkyMat")
; === Subresources ===
[sub_resource type="Environment" id="Env"]
background_mode = 2
background_sky = SubResource("Sky")
background_sky_custom_fov = 0.0
background_mode = 0
tonemap_mode = 0
glow_enabled = false
ambient_light_color = Color(0.25, 0.25, 0.3)
ambient_light_color = Color(0.25, 0.25, 0.3, 1.0)
ambient_light_energy = 0.4
ambient_light_sky_contribution = 0.5
ambient_light_sky_contribution = 0.0
; === Scene Root ===
[node name="KitDemo" type="Node3D"]
@@ -147,7 +134,7 @@ environment = SubResource("Env")
transform = Transform3D(0.866, 0, -0.5, -0.354, 0.707, -0.612, 0.354, 0.707, 0.612, 0, 5, 0)
light_energy = 1.2
light_indirect_energy = 0.8
light_color = Color(1.0, 0.95, 0.9)
light_color = Color(1.0, 0.95, 0.9, 1.0)
shadow_enabled = true
light_bake_mode = 2
directional_shadow_max_distance = 30.0
@@ -161,7 +148,7 @@ directional_shadow_blend_splits = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 2.4, 1.5)
light_energy = 0.4
light_indirect_energy = 0.5
light_color = Color(1.0, 0.85, 0.7)
light_color = Color(1.0, 0.85, 0.7, 1.0)
light_bake_mode = 2
omni_range = 6.0
omni_attenuation = 0.8
@@ -178,11 +165,10 @@ max_distance = 10.0
; --- LightmapGI: baked global illumination ---
[node name="LightmapGI" type="LightmapGI" parent="."]
quality = 2
bounces = 3
bounce_indirect_energy = 1.0
texel_scale = 1.0
texel_subdiv = 4
max_texture_size = 2048
use_denoiser = true
denoiser_strength = 0.0
interior = true