Quick answer: Enable Cast Static Shadow, Affect Distance Field Lighting, and ensure the static mesh has Generate Mesh Distance Fields on. For Lumen/raytraced setups, also check Cast Shadow As Two Sided for foliage with translucent leaves.
A painted forest of bushes and trees looks colorful but oddly flat — no shadows on the ground, no self-shadowing, leaves rendering as if facing a uniform light source. The directional light has Cast Shadow on. Other static meshes shadow correctly. Only the foliage looks wrong.
Foliage-Specific Shadow Pipelines
Foliage instances render through UHierarchicalInstancedStaticMeshComponent (HISM). Shadow paths supported:
- Static — precomputed in Lightmass. Requires a lighting build.
- Distance Field Shadows — runtime, soft shadows at distance.
- Lumen / Ray Traced — runtime, accurate but expensive.
- Cascaded Shadow Maps — runtime, near-camera, default for movable lights.
If none of these is enabled for your foliage type, it looks shadeless.
Fix 1: Enable Foliage Type Shadow Flags
Open the FoliageType asset (the SK_FoliageGrass, FT_Bush, etc.). In the details panel under Lighting:
Cast Static Shadow: true
Cast Dynamic Shadow: true
Affect Distance Field Lighting: true
Affect Dynamic Indirect Lighting: true
These propagate to every instance. If the foliage type doesn’t exist as a standalone asset (you painted with a static mesh directly), drag the static mesh into the foliage tool, choose “Promote to Foliage Type Asset”, and set the flags on the resulting asset.
Fix 2: Generate Distance Fields on the Mesh
For distance-field shadows to work, the source static mesh must have a distance field generated. Open the static mesh asset and under Build Settings:
Generate Mesh Distance Fields: true
Distance Field Resolution Scale: 2.0 // higher for trees
Click Apply Changes and wait for the rebuild. Check the asset has a distance field by clicking Show → Distance Field in the static mesh editor.
Fix 3: Project-Wide Distance Field Setting
Even with foliage flags correct, distance field shadows require:
// DefaultEngine.ini
[/Script/Engine.RendererSettings]
r.GenerateMeshDistanceFields=True
r.DistanceFieldShadowing=True
After editing, restart the editor. Without these, the engine doesn’t allocate distance field buffers and foliage shadows fall through.
Fix 4: Translucent Leaves Need Two-Sided
For tree leaves using a Masked or Translucent material, single-sided rendering means back-facing leaves don’t shadow at all — the leaf canopy looks like a wire frame from below. In the FoliageType:
Cast Shadow As Two Sided: true
And in the leaf material: set Two Sided to true. The cost is double pixel shader work for leaves, but the visual difference is dramatic.
Fix 5: Build Lighting or Switch to Lumen
For projects using Lumen Global Illumination, ensure Lumen is fully enabled:
r.Lumen.HardwareRayTracing=1
r.Lumen.ScreenProbeGather.RadianceCache=1
Lumen handles bounced lighting on foliage automatically without a bake. If you’re still on Lightmass, build lighting via Build → Build Lighting Only with Production quality. Foliage participates in the bake if its Cast Static Shadow is on.
Verifying
Toggle Show → Visualize → Shadow Frustums in the viewport. Foliage instances inside the cascade should produce shadow casters; if they don’t, the foliage type still has Cast Dynamic Shadow off. Save and re-test in PIE; the ground beneath foliage should show distinct shadow patterns.
“Foliage shadows need flags on the FoliageType, the source mesh, and the project. Miss any one and the canopy goes flat.”
A boilerplate FoliageType preset with Cast Static Shadow + Distance Fields enabled saves hours across new vegetation types.