Quick answer: Wire your displacement into the Vertex Position output of the Master Stack. URP applies the vertex stage to all passes including ShadowCaster. If shadows still ignore the deformation, the displacement is in a custom function gated to a specific pass — remove the gate.

Wind sways your tree mesh. The shadow on the ground stays a perfect undisplaced silhouette. The mesh visibly leans left, the shadow stays straight up. The shadow pass is using the un-displaced vertices.

The Symptom

Vertex displacement (wind, water, dissolve, morph) renders correctly in Forward/GBuffer pass, but shadow cast on the ground is the static mesh shape. Shadow position and outline are wrong relative to the visibly displaced surface.

What Causes This

Shaders have multiple passes (Forward, ShadowCaster, DepthOnly, MotionVectors). Each pass has its own vertex computation. If your displacement is computed only in the Forward pass, the ShadowCaster runs the original vertex positions and the shadow stays static.

The Fix

Step 1: Use Master Stack Vertex Position. In Shader Graph (URP), the Vertex Position output of the Master Stack feeds every pass that runs the vertex stage, including ShadowCaster. As long as your displacement chain ends at this output, all passes get it.

Master Stack:
  Vertex
    Position:  [Position(Object) + DisplaceXYZ]
    Normal:    (recompute if needed)
    Tangent:   (recompute if needed)
  Fragment
    Base Color, Smoothness, ...

Step 2: Recompute normal. Displacement without normal recomputation causes lighting to look wrong. Compute the per-vertex normal numerically (sample displacement at three nearby positions, take cross product) or accept flat-look and pass the original normal.

Step 3: Custom Function pass safety. If your displacement uses a Custom Function node, ensure the include doesn’t gate the function to a specific pass. #ifdef SHADERGRAPH_PREVIEW guards are fine; #ifdef _MAIN_LIGHT_SHADOWS or pass-specific guards exclude shadow.

Older URP Versions

URP < 12 did not always run Shader Graph vertex stage in shadow casters. Upgrade to a current URP if possible. If stuck on an older version, the workaround is to write the shadow caster pass manually as a custom subshader pass and copy the displacement HLSL into it.

Tessellation Caveat

HDRP supports tessellation that further displaces. Tessellated displacement does run in the shadow caster but requires the ShadowCaster pass have tessellation enabled too. Toggle in the Master Stack settings → Surface Options.

Verifying

Drop a primary directional light. Place a flat ground plane. Place your mesh above it. Apply heavy displacement. Shadow on the ground should match the displaced silhouette in real time.

Frame Debugger → ShadowCaster pass → inspect the input vertex buffer; the values should match displaced positions, not original.

Understanding the issue

Shader bugs manifest visually but trace to invisible state. Triage requires understanding the runtime context as much as the source.

The specific bug described above is the kind that surfaces during integration rather than unit testing. It depends on a combination of factors: the asset configuration, the runtime state, the platform's specific behavior. In isolation, each piece looks correct; in combination, the bug emerges. This is why thorough integration testing - playing the actual game in realistic conditions - catches things that automated tests miss.

Why this happens

This bug class disproportionately affects late-stage development. The work to surface it is interactive testing in realistic conditions, which only really happens after the gameplay is in place and assets are populated. Catching it early requires deliberate testing of conditions that look unimportant.

At the engine level, the behavior comes from a deliberate design decision in Unity. The engine team chose a particular trade-off - usually performance versus convenience, or generality versus specificity - and that trade-off has consequences when you push against it. Understanding the trade-off is what turns 'this bug is mysterious' into 'this bug is the expected consequence of this design'.

Verifying the fix

Verifying this fix in isolation is straightforward: reproduce the bug, apply the change, confirm the bug no longer reproduces. The harder verification is regression - did this fix introduce a new bug elsewhere? Run your standard regression suite, plus any tests that exercise the same code path with different inputs.

Reproducibility is the prerequisite for verification. If you can't reliably reproduce the bug pre-fix, you can't reliably verify it post-fix. Spend time getting a clean reproduction before you write any fix code. The fix is fast once you understand the reproduction; the reproduction is the slow part.

Variations to watch for

Related bug classes often share the same root cause. If you find yourself fixing this issue, look for cousins: similar symptoms in adjacent systems, the same data flow but a different value, or the same fix pattern in another module. The catalog of 'we've seen this before' becomes valuable institutional knowledge.

Adjacent bugs often share a root cause. After fixing the case you've found, spend an hour searching the codebase for similar patterns. What's the same call with different arguments? The same data flow with a different entity type? The same lifecycle issue in a sibling system? Each match is a candidate for the same fix, or a related fix that prevents future bugs of the same class.

In production

For shipping titles with a long support window, watch for this issue resurfacing after dependency updates. Engine upgrades, driver updates, OS releases - each one can resurface a bug class you thought you'd fixed because the underlying behavior changed slightly. Regression tests catch the obvious ones; player reports catch the rest.

When triaging a similar issue in production, prioritize gathering data over hypothesizing causes. A player report describes a symptom; what you need is a build SHA, a session timestamp, and ideally a screen recording or session replay. With those, the bug becomes tractable. Without them, you're guessing at hypothetical reproductions that may not match what the player actually hit.

Performance considerations

If this issue manifests under high load (many actors, many particles, many network connections), profile the post-fix code path with realistic counts. The original cost was a bug; the new cost is real work, and real work has a budget.

Diagnostic approach

Diagnosing this class of bug benefits from a structured approach: confirm the symptom, isolate the variables, hypothesize the cause, and verify the hypothesis before writing fix code. Skipping the isolation step is the most common mistake; without it, fixes often address symptoms while the underlying cause continues to produce other variations.

For Unity-specific diagnostics, the editor's profiler is the canonical starting point. Capture a representative frame with the symptom present; compare against a frame without the symptom; the diff often points directly at the cause. If the symptom is non-deterministic, capture multiple frames and look for the pattern - the cause is usually a state transition or a specific input value rather than a continuous effect.

Tooling and ecosystem

The tooling around this bug class matters as much as the fix itself. Good logging, accessible profilers, and clear error messages turn 30-minute investigations into 5-minute ones. If your project doesn't have visibility into this code path, the first fix should add the visibility - the second fix uses it.

Within Unity, the relevant diagnostic surfaces include the standard frame debugger, memory profiler, and engine-specific debug overlays. Each one shows a different facet of what's happening. The frame debugger reveals draw call ordering and state transitions; the memory profiler shows allocation patterns; the debug overlay reveals per-system state. Bugs that resist one tool usually surrender to another - the trick is knowing which tool to reach for first.

Edge cases and pitfalls

Boundary conditions deserve specific testing attention. What happens when the input is zero, maximum, negative, or NaN? What happens at the start of a session vs hours in? What happens at the boundary between two systems handling the same data? These are where bugs hide and where regression tests are most valuable.

When writing a regression test for this fix, focus on the boundary conditions that surfaced the original bug. Tests that exercise the happy path catch obvious regressions; tests that exercise the boundary catch the subtler regressions that look like new bugs but are really the original returning. The latter are the tests that earn their keep over the long life of the project.

Team communication

Document the fix and its rationale in the commit message or attached engineering doc. Future engineers will encounter related issues; the rationale tells them whether your fix is reusable or specific to the case at hand. Without rationale, the fix gets reverted or copied incorrectly.

If this fix touches a system several engineers work in, a short writeup in the team's engineering channel helps. Not a full design doc - a paragraph explaining what was wrong, what's fixed, and what to watch for. Future engineers encountering similar symptoms will search for the fix; making it findable is a small investment that pays back later.

“Vertex Position in the Master Stack reaches every pass. No pass-specific guards. Shadows match the silhouette.”

Related Issues

For shaders not updating in build, see shader updates. For Time node frozen, see Time node.

Vertex Position propagates. Recompute normal. Shadows track.