Lighting: fixed daytime rig, real surface materials, dynamic lights #3

Closed
zwitschi wants to merge 4 commits from gameplay-lighting-0.1.0 into main
pull from: gameplay-lighting-0.1.0
20 changed files with 81 additions and 41 deletions
Showing only changes of commit 240bad9af1 - Show all commits

No files matched your search

+9 -2
View File
@@ -2,7 +2,12 @@
GlobalDefaultGameMode="/Script/GigLine.GigLineGameModeBase"
[/Script/Engine.RendererSettings]
; Leave defaults for 0.1.0; quality preset is documented at release time.
; Dynamic-only lighting. With static lighting allowed, the stationary sun and
; sky light demanded a baked lighting build and the editor warned
; "LIGHTING NEEDS TO BE REBUILT" (Build Lighting Only / BuildLighting) on every
; map. The demo is a fixed daytime scene lit entirely dynamically, so disable
; static lighting outright — nothing to build, no warning.
r.AllowStaticLighting=False
[URL]
GameName=GigLine
@@ -10,7 +15,9 @@ GameName=GigLine
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
bEnablePlugin=False
bAllowNetworkConnection=False
SecurityToken=01A1B5CDAFDE7AAEB5DFBB48880D25DE
; SecurityToken intentionally empty: it is a credential, and the plugin is
; disabled and excluded from shipping. Never commit a real token here.
SecurityToken=
bIncludeInShipping=False
bAllowExternalStartInShipping=False
bCompileAFSProject=False
Binary file not shown.
Binary file not shown.
+2
View File
@@ -183,3 +183,5 @@ Scope: facts and traps that cost time to establish. Planned work lives in [TODO.
- **One band per object loses geometry downstream.** `crossing_band()` created `Crossing_Markings` each call, so Blender renamed the second and third to `.001`/`.002`; `site_assembly.py` appends by exact name, so only one crossing ever reached the game. Build all bands into a single mesh instead of one object per band.
- **Street arc length -> UE X:** s=0 is the west end of the block (UE X −27966 cm) and s increases eastward, so the designated mid-block crossing at s=130.1 m is UE X ≈ −14956, not the −24291 used by an earlier camera (that is the s=36.6 crossing).
- **Camera placement in the demo map needs the mesh bounds, not intuition.** The hero façade body spans UE Y −1457..−200, so a "street level" camera at Y −400 is *inside* the building and renders its unlit back face. Read `get_bounding_box()` on the staged meshes before choosing a camera.
- **"LIGHTING NEEDS TO BE REBUILT" (Build Lighting Only / `BuildLighting`) appears whenever a map has Stationary/Static lights and no baked lightmap.** For a fully dynamic scene the clean fix is `r.AllowStaticLighting=False` in `Config/DefaultEngine.ini` plus `set_mobility(ComponentMobility.MOVABLE)` on the directional light, sky light and height fog (and MOVABLE on the staged mesh components). Nothing to build, warning gone. Note the cvar is read at startup, so each new commandlet/game run picks it up.
- The Android File Server `SecurityToken` kept reappearing in `Config/DefaultEngine.ini`; the plugin is disabled and excluded from shipping, so the value is cleared and must stay empty — it is a credential and must not be committed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+16 -2
View File
@@ -123,6 +123,12 @@ def build():
comp.set_editor_property(prop, value)
except Exception as exc: # noqa: BLE001
log(f"sun.{prop} not set: {exc!r}")
# Movable: static lighting is disabled (r.AllowStaticLighting=False),
# so nothing needs a lighting build.
try:
comp.set_mobility(unreal.ComponentMobility.MOVABLE)
except Exception as exc: # noqa: BLE001
log(f"sun mobility not set: {exc!r}")
log("staged: Demo_Sun (pitch -50, yaw 120, intensity 4, warm)")
sky = spawn(unreal.SkyLight, unreal.Vector(0, 0, 2000), "Demo_SkyLight")
@@ -134,6 +140,10 @@ def build():
comp.set_editor_property(prop, value)
except Exception as exc: # noqa: BLE001
log(f"sky.{prop} not set: {exc!r}")
try:
comp.set_mobility(unreal.ComponentMobility.MOVABLE)
except Exception as exc: # noqa: BLE001
log(f"sky mobility not set: {exc!r}")
log("staged: Demo_SkyLight (intensity 2.6, real-time capture)")
spawn(unreal.SkyAtmosphere, unreal.Vector(0, 0, 0), "Demo_Sky")
@@ -152,6 +162,10 @@ def build():
comp.set_editor_property(prop, value)
except Exception as exc: # noqa: BLE001
log(f"fog.{prop} not set: {exc!r}")
try:
comp.set_mobility(unreal.ComponentMobility.MOVABLE)
except Exception as exc: # noqa: BLE001
log(f"fog mobility not set: {exc!r}")
log("staged: Demo_Fog (height fog, density 0.008)")
# Fixed exposure: without this the same road renders washed out or black
@@ -185,7 +199,7 @@ def build():
actor = spawn(unreal.StaticMeshActor, unreal.Vector(-10722.5, -1443.0, 0.0), "Hero_Facade")
if actor:
actor.static_mesh_component.set_static_mesh(hero)
actor.static_mesh_component.set_mobility(unreal.ComponentMobility.STATIC)
actor.static_mesh_component.set_mobility(unreal.ComponentMobility.MOVABLE)
log("staged: Hero_Facade at the building line")
else:
log("MISSING: SM_HeroFacade — run Tools/ue_hero_facade_import.py")
@@ -212,7 +226,7 @@ def build():
actor = spawn(unreal.StaticMeshActor, unreal.Vector(0, 0, 0), f"Demo_{name}")
if actor:
actor.static_mesh_component.set_static_mesh(mesh)
actor.static_mesh_component.set_mobility(unreal.ComponentMobility.STATIC)
actor.static_mesh_component.set_mobility(unreal.ComponentMobility.MOVABLE)
mat = ensure_material(mat_name, rgb)
if mat:
actor.static_mesh_component.set_material(0, mat)
+22 -5
View File
@@ -96,11 +96,28 @@ try:
else:
log("floor spawn failed")
if spawn(unreal.DirectionalLight, unreal.Vector(0, 0, 900), "RenderKeyLight",
rot=unreal.Rotator(pitch=-38.0, yaw=35.0, roll=0.0)):
log("staged: DirectionalLight")
if spawn(unreal.SkyLight, unreal.Vector(0, 0, 1200), "RenderFillSky"):
log("staged: SkyLight")
# Lights are Movable and the project disables static lighting
# (r.AllowStaticLighting=False), so no baked lighting build is needed and
# the editor stops asking to rebuild lighting.
sun = spawn(unreal.DirectionalLight, unreal.Vector(0, 0, 900), "RenderKeyLight",
rot=unreal.Rotator(pitch=-38.0, yaw=35.0, roll=0.0))
if sun:
comp = sun.get_component_by_class(unreal.DirectionalLightComponent)
if comp:
try:
comp.set_mobility(unreal.ComponentMobility.MOVABLE)
except Exception as exc: # noqa: BLE001
log(f"key light mobility not set: {exc!r}")
log("staged: DirectionalLight (movable)")
sky = spawn(unreal.SkyLight, unreal.Vector(0, 0, 1200), "RenderFillSky")
if sky:
comp = sky.get_component_by_class(unreal.SkyLightComponent)
if comp:
try:
comp.set_mobility(unreal.ComponentMobility.MOVABLE)
except Exception as exc: # noqa: BLE001
log(f"fill sky mobility not set: {exc!r}")
log("staged: SkyLight (movable)")
if spawn(unreal.SkyAtmosphere, unreal.Vector(0, 0, 0), "RenderSky"):
log("staged: SkyAtmosphere")