d631ff784a
- Restructured kit_demo.tscn from linear demo to enclosed 5.12x5.12 room with walls, floor tiles, pillar, beam, doorway, window - Added WorldEnvironment with ProceduralSky for ambient lighting - Added DirectionalLight3D (sun key light, 45° angle, shadows enabled) - Added OmniLight3D (warm interior fill light) - Added ReflectionProbe for interior specular reflections (box projection, room-sized extents) - Added LightmapGI with balanced quality settings (bounces=3, texel_scale=1.0, max_texture_size=2048, denoiser=true) - Added tool script (kit_demo.gd) that prints bake status in editor - Added bake_lighting.gd CLI bake script (requires GPU-enabled instance) - Updated project.godot with reflection atlas and shadow map quality settings Headless baking note: Godot's standard editor build requires a GPU/display for LightmapGI.bake(). Open the scene in the Godot editor and click 'Bake Lightmap' on the LightmapGI node to generate the baked lightmap data.
49 lines
1.5 KiB
GDScript
49 lines
1.5 KiB
GDScript
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.
|
|
#
|
|
# This script provides feedback in the editor Output panel.
|
|
|
|
@tool
|
|
|
|
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")
|
|
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("")
|
|
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)
|
|
|
|
|
|
func _find_lightmap_gi() -> LightmapGI:
|
|
for child in get_children():
|
|
if child is LightmapGI:
|
|
return child
|
|
return null
|