H_CachedShadows for URP (Lighting Performance)
H Assets - H Works Interactive
$16.49
$32.99
50%OFF
Jump AssetStore
Cache your URP shadow maps once and reuse them every frame. Static lights cost nothing, moving characters still cast live shadows blended on top. Forward, Forward+ and Deferred+.Stop re-rendering shadows that never change.URP redraws every shadow map every frame, even for lights and geometry that haven't moved. Your buildings, your street lamps, the sun. All of it gets rasterized again from scratch, frame after frame. That's why point lights feel unaffordable (each one is six shadow renders), why you end up turning shadows off on half your lights, and why a third shadowed lamp can sink a mobile or VR build.HDRP has had cached shadows for years. URP still hasn't, and the roadmap request has sat open since 2023. This asset adds it.──────────────────────────────────────────────────How it worksH_CachedShadows takes over URP's shadow passes and binds its own persistent shadow atlas into URP's shader globals. Your Lit shaders keep sampling shadows exactly as before and never know the map is cached. A light re-renders only when it actually changes: it moves, its range or angle changes, it toggles, or you invalidate it yourself. Not on a timer, not because you looked away. Wander a level as long as you like and the static lights never redraw.──────────────────────────────────────────────────PerformanceWith static lights sitting still, shadow rendering drops to a texture bind. The rasterization doesn't happen; the pass hands your shaders an atlas that's already in VRAM and gets out of the way. While Dynamic Caster Composite is on you still pay for:• the small screen rectangles your moving objects occupy (this scales with your movers, not your light count)• one extra shadow atlas in memory• the sun re-rendering when the camera travels a long way (see Limitations)──────────────────────────────────────────────────Why the dynamic shadows stay cheapThe awkward part of caching shadows is that getting a moving character into a cached map normally means re-rendering the map, which throws the cache away. That's why "cached shadows" and "characters that cast shadows" usually means picking one.This asset keeps two atlases. The cache holds your static world, rendered once and then left alone. The composite is a copy of the cache with your movers drawn on top, and it's the one your shaders sample. The static shadows in the cache are never redrawn.The composite update stays small. Each frame it only touches the lights a mover is physically inside, and for a point light only the one or two cube faces the mover falls in, not all six. Inside each of those it copies back just the rectangle the mover's shadow covers and redraws that. Everything else keeps last frame's pixels. A scene with 200 cached lamps and one walking player redraws a handful of small rectangles a frame instead of 200 shadow maps.The cost is one extra shadow atlas in memory, at whatever resolution you already use. In return your static shadows stay pixel-identical and effectively free while your characters cast correct, moving shadows on top of them. The sun works the same way per cascade: the cascade the player's standing in gets the live overlay, the far ones stay frozen.──────────────────────────────────────────────────Features◆ Point, spot and directional lights. Forward, Forward+ and Deferred+.◆ Two caching modes, mirrored across light types. Point and spot use Cache and hold or Manual; the sun uses Cached Cascades or Manual.◆ URP Config Forker (optional). One click raises URP's shadow slots cap from 256 to 512 and the shadow atlas resolution from 8K to 16K, when you have the VRAM for it.◆ Automatic per-light invalidation. Move a lamp and its shadow updates; nothing else re-renders. No timers, no refresh calls.◆ Camera-independent point/spot caching. The lamps don't care where the player is looking, they will be cached once and then reused.◆ Live dynamic shadows composited on top of the cache, per cube face, per rectangle, per cascade.◆ Stable atlas slots. Each light keeps a permanent slot, so its pixels survive between frames.◆ The same lights URP would shadow. The keep-set follows URP's own priority order, so toggling the asset doesn't change which lights get shadows.◆ Amortised refreshes. Big updates spread over a few frames instead of spiking, with a tunable budget.◆ Optional shared settings asset to drive several renderers from one place.◆ RenderGraph, Unity 6 / URP 17+. Full C# source, no DLLs.──────────────────────────────────────────────────Setup1. Add the render feature to your Universal Renderer.2. Put the Dynamic Shadow Caster component on anything that moves (on the root; children are automatic).3. Ship it.──────────────────────────────────────────────────Limitations• Classic Deferred can't cache point and spot shadows. URP resolves those inside its own shadow pass using an internal light index that only exists while the pass runs, and this asset replaces the pass, so there's nothing for the cache to hook into. It's a URP architecture limit, not a bug. The asset detects it, hands point and spot back to URP so they still render (uncached), and locks the toggle off in the inspector with an explanation. The sun still caches. Deferred+ is the same deferred shading with a clustered light loop, it's one dropdown away, and it caches everything.• The sun re-renders when the camera moves far. URP builds directional cascades around the camera, so a cached cascade is only valid while the camera stays near where it was cached. In Cached Cascades mode it re-fits after a few metres of travel or a few degrees of rotation and holds otherwise; Manual never re-fits on its own. This is how cascades work, and HDRP's cached shadows carry the same caveat. But don't worry, this is much faster than actually rendering the directional shadows every frame. Point and spot lights have no such limit, they will be cached once and then held.• Everything that moves needs the component. The static/dynamic split runs on Renderer.staticShadowCaster, which this asset manages. Anything without a Dynamic Shadow Caster counts as static, so if it moves, its shadow freezes where it was first cached. Animated meshes without the component get a warning that names them, so you won't ship it by accident. Because the asset owns that flag, don't repurpose it while the asset is enabled.• URP caps shadowed lights at 256, and this asset ships the fix. A point light costs 6 shadow atlas slices and a spot costs 1, so stock URP gives you roughly 42 point lights or 256 spots shadow slots at once. And if your lamps only shine downward, spots stretch the same budget six times further than points. This asset tackles this URP limitation, the included H URP Config Forker doubles that ceiling to 512 and raises the shadow atlas from 8K to 16K with one click, giving you 4 times more shadow space, for far more lights and sharper shadows when you have the VRAM.──────────────────────────────────────────────────Good to know• Dynamic Caster Composite is play-mode only and uses a second shadow atlas.• Composite mode needs additional light shadows enabled on your URP asset.• Unity 6+ / URP 17+ with RenderGraph.──────────────────────────────────────────────────Built for our own gameThis wasn't written as a tech demo. Silent Strike is our in-development tactical shooter and the reason the asset exists: heavily lit interiors, a lamp on every pillar, and a shadow budget stock URP couldn't pay. You can see it running in the video above.It's been stress-tested against 150+ shadow-casting lights at once, debugged against real player builds and not just the editor where the interesting bugs hide, and checked on Deferred+, Forward+ and Forward until each behaved the same. The per-frame cost stays inside a 1 ms budget. Every limitation above was found in a real scene and written down instead of hidden.──────────────────────────────────────────────────See for yourselfDownload the demo here.──────────────────────────────────────────────────SupportEmail: assetsupport@hworksinteractive.comDiscord: https://dsc.gg/hworksinteractive

