
説明
Virtual Shadow Maps and decal components both fall apart at scale: VSMs pay an enormous GPU and CPU culling cost past a few hundred movers, and one decal per unit means one draw call per unit — your RTS army, your horde wave, your projectile swarm drowns the renderer before it drowns the player.
Material-Driven Shadows takes the opposite approach. Every shadow that shares a mesh and a material lives in one instanced static mesh component, and the projection itself is material math rather than rasterisation: the CPU writes a single transform plus four custom-data floats per unit, and the vertex and pixel shaders do the rest — sliding the shadow along the light direction as a unit jumps, stretching it as the sun drops towards the horizon, and blending it softly into hills and stairs with a depth fade instead of per-frame ground traces.
Drop the component on your unit Blueprint, press Play, and the whole army costs one draw call. The included demo map measures 1,101 shadow casters in 1 draw call at 0.91 ms of total subsystem CPU time.
KEY FEATURES
One draw call per mesh/material pair — not per unit. 100 units or 10,000 units cost the same number of draw calls, and GetNumBatches() tells you exactly what that number is.
The projection lives in the material. Per-instance custom data carries radius, opacity, height above ground and light-stretch to the GPU. Rotating your day/night sun re-stretches every shadow in the world in the vertex shader, at zero extra CPU cost.
Jump and fly handling out of the box — shadows slide away from an airborne unit and fade out as it climbs, driven by two tunable heights per component.
Slope fitting without CPU traces: a depth-fade blend makes the flat quad hug hills, ramps and stairs instead of clipping through them.
Bounded ground-trace cost. Round-robin, budgeted downward traces (default 256 per update, world-wide) make trace cost a constant you choose — or skip traces entirely with Owner Location mode, or feed heights from your own terrain data with Manual mode.
Zero-cost spawn and despawn — instance slots are recycled through a free list, never removed.
No render-state churn: one batched transform write plus one ranged custom-data write per batch, without recreating the render proxy.
Nothing to place in the level. A world subsystem creates and owns everything automatically.
Fully Blueprint-exposed — component, subsystem, stats struct and a function library. A Blueprint-only project can use every feature.
Built-in profiling: a live stats struct plus the MDS.Enabled 0/1 console variable for an instant A/B against the engine shadows.
Tunable from Project Settings — quad, master material, batch mode, update rate, trace budget, culling distances and light-refresh interval, without touching code.
Ready-to-use master material with documented parameters, plus a full rebuild recipe in the docs.
Playable demo map with a stats HUD, batch spawning and a sun that swings from noon to sunset.
Full C++ source, Epic coding standard, engine modules only — no third-party libraries.
GOOD TO KNOW
These are projected blob shadows, not shadow maps: they do not reproduce a silhouette, do not self-shadow and do not receive on walls. Use them for crowds and keep CSM/VSM for hero characters.
The system follows the scene primary directional light (or an explicit direction override). Point and spot lights do not drive these shadows.
One draw call per mesh/material pair — mixing shadow quads multiplies batches.
Requires a shadow-receiving ground surface; shadows land on the ground point beneath each unit.
Documentation: https://github.com/SimulatedFlow/ue-plugin-MaterialDrivenShadows · Support: [email protected]




















