# 5. Worked Example: Fullscreen Flash Part of [[Custom URP Renderer Features]]. Prev: [[4. RecordRenderGraph and Frame Data]]. Next: [[6. Renderer Feature Pitfalls]]. This is *not* the tint-vignette already in [[URP Shaders and Shader Graph]]. It is a short **hit or pause flash** you can turn off for reduced motion ([[Accessibility]]). ## 5.1 Shader and material SRP Blit Shader or a Fullscreen Shader Graph that samples `_BlitTexture` (Fetch Color Buffer / blit source) and lerps toward a color by `_FlashAmount` (0-1). Keep the graph simple. Photosensitive design: no strobe; a single decayed pulse is enough ([[Combat Feel and Hit Feedback]]). ## 5.2 Feature Use `FullscreenFlashFeature` from part 3. Add it to the camera's renderer. Injection: **After Rendering Post Processing** if the flash should sit on top of the grade; **Before Rendering Post Processing** if Volumes should grade the flash (pick one and look at it). Expose `_FlashAmount` on the material. A tiny runner (not compiled): ```csharp using UnityEngine; /// <summary>Decays a flash material property. NOT compiled in Unity.</summary> public sealed class FlashPulse : MonoBehaviour { [SerializeField] Material flashMaterial; [SerializeField] float decay = 8f; [SerializeField] string property = "_FlashAmount"; int id; float amount; void Awake() => id = Shader.PropertyToID(property); public void Pulse(float strength = 1f) => amount = Mathf.Max(amount, strength); void LateUpdate() { if (flashMaterial == null) return; amount = Mathf.MoveTowards(amount, 0f, decay * Time.unscaledDeltaTime); flashMaterial.SetFloat(id, amount); } } ``` Call `Pulse` from a hit hook. If reduced motion is on, do not call it (or enqueue nothing when amount is 0). Prefer a **material instance** so you do not dirty a shared asset on disk. ## 5.3 Playtest checklist 1. Play Mode: a key or a hit pulses a brief flash, then fades. 2. **Window > Analysis > Render Graph Viewer**: the "Fullscreen Flash" pass reads the color texture and writes a destination; `cameraColor` should point at that destination if you used the avoid-blit-back assignment. 3. With `_FlashAmount` at 0, either skip `EnqueuePass` or let the pass be cheap. If you left `AllowPassCulling(false)` on, turn it off. 4. Frame Debugger: one blit, not a ping-pong of two. 5. A second camera (scene view / preview) should not crash if the Feature is on that renderer - skip the pass for preview cameras if you have a reason (`UniversalCameraData` can tell you the camera type; confirm the property name in the API). ## Exercise Move the injection point and describe, in one sentence, whether the bloom from [[Post-Processing]] blooms the flash. That is the beat you just chose. ## Sources - Blit using the render graph system (6000.5): https://docs.unity.com/en-us/engine/6000.5/manual/render-pipelines/universal-render-pipeline/customizing-urp/render-graph/blit