← Back to project technical overview

Pine trees in direct sunlight (noon) looked like sheets with no volume, with dappled shadows completely missing under the trees and a bright, flat ground. Shadowed areas were normal — a typical symptom of directional light castDynamicShadows=false, which Lumen indirect lighting cannot make up for.

— On-site symptom description

1. Root-Cause Diagnosis (Three Rounds of Elimination)

Round 1: misdiagnosed Lumen off → eliminated

At first glance, Config/DefaultEngine.ini had r.DynamicGlobalIlluminationMethod=0 and r.ReflectionMethod=0 (= None). Restoring to 1 (Lumen) and restarting PIE produced no change.

Conclusion: Lumen only controls the softness of indirect lighting; the presence/absence of dynamic shadows is not its job — it belongs to the castDynamicShadows switch on the directional light component.

Round 2: read runtime CVar → confirmed GI is on

Read the runtime-effective values using Unreal Editor MCP 8017's EditorToolset.EditorAppToolset.SearchCVars:

CVarActual valueConclusion
r.DynamicGlobalIlluminationMethod1 (Lumen)Lumen GI on ✅
r.Lumen.DiffuseIndirect.Allow1Lumen indirect lighting allowed ✅
r.ContactShadows1Contact shadows on ✅
r.Nanite1Nanite on ✅
r.Shadow.Virtual.Enable1Virtual shadow maps (VSM) on ✅

Round 3: direct to light component properties → root cause locked

Sun/Moon is managed by the level SunMoonDaySequenceActor_0; component path:
/Game/_LevelSeting/MMOGameMap_01.MMOGameMap_01:PersistentLevel.SunMoonDaySequenceActor_0.Sun

Read the Sun/Moon key attributes with ObjectTools.get_properties:

PropertySun valueMoon valueJudgment
castShadowstruetrueMaster switch on ✅
castStaticShadowstruetrueStatic shadows on ✅
castDynamicShadowsfalsefalse⚠️ Root cause!
intensity1890060Normal
castRaytracedShadowUseProjectSetting—Follows project setting

2. Why castDynamicShadows=false Causes Paper-Thin Foliage

  1. Pine trees are dynamic Foliage instances, not static meshes; the sun is a Movable directional light (DaySequence must rotate to follow time).
  2. Dynamic shadows on a Movable directional light rely entirely on castDynamicShadows. false → dynamic foliage casts no shadows at all.
  3. Only Static ground can receive static shadows → the ground is bright but tree shadows are nowhere; visually flat.
  4. VSM happens to be on, so dynamic shadows depend even more on castDynamicShadows.

3. The Fix (One MCP set + read-back + save)

# Unreal Editor MCP 8017 · Python 调用序列
# 1. set Sun.castDynamicShadows = true
ObjectTools.set_properties(
    instance="/Game/_LevelSeting/MMOGameMap_01..."
             ":PersistentLevel.SunMoonDaySequenceActor_0.Sun",
    values={"castDynamicShadows": True})

# 2. set Moon.castDynamicShadows = true(同理)

# 3. 回读验证(必须,set 可能静默失败)
ObjectTools.get_properties(
    instance=Sun,
    properties=["castDynamicShadows","castStaticShadows"])
# → castDynamicShadows=True ✅

# 4. 保存关卡
AssetTools.save_assets(asset_paths=["/Game/_LevelSeting/MMOGameMap_01"])

No editor restart, straight into PIE at noon → foliage restored: dappled shadows appear under the trees and foliage regains its sense of volume.

4. How to Quickly Diagnose Similar Problems in the Future (Diagnostic Path)

# 全在 Unreal Editor MCP 8017 上
1. SceneTools.find_actors(name="SunMoonDaySequence") → 找 Actor refPath
2. ActorTools.get_components(actor) → 列出 Sun / Moon 组件路径
3. ObjectTools.get_properties(instance=Sun,
      properties=["castShadows","castStaticShadows","castDynamicShadows","intensity"])
4. castDynamicShadows=false → set true → 回读 → save_assets 关卡

5. Possible Recurrence Points

This fix changed the level instance property. If dynamic shadows vanish again after restarting the editor/PIE → the Sun/Moon components are default child objects of the DaySequence plugin class and their template values are still false; the same setting must also be applied on the plugin class CDO (the component's _GEN_VARIABLE template) for a permanent fix.