
URP screen-space outline effect with RenderGraph, VR/WebGL2 compatibility, different filters and layer filteringRequires Unity URP Rendergraph to be enabled. You can try this package here: https://atan-games.itch.io/atan-outlineA game I developed that uses this outline: https://atan-games.itch.io/polaris-incI was unable to find a working implementation of a screen-space outline in Unity URP RenderGraph that allowed me to exclude certain layers from the outline. So, I ended up building it myself.CompatibilityThis package only works with the Universal Render Pipeline (URP) version 15 or higher. It is designed for 3D projects.I’ve tried to make it as compatible as possible. Both mobile and desktop platforms should work fine. This asset supports WebGL2, WebGPU, and VR. It should work with both single-view and multi-view VR rendering.Note: I have only tested it on an Oculus Quest 3 using OpenXR, so I cannot guarantee full compatibility with all headsets.If you run into any issues, feel free to contact me via email.FeaturesEssential Outline Settings: Adjust settings like Outline Size, depth and normal thresholds, filters, output mode, distance-based fading, outline color, and more.Screen-Space Outline: This package uses a URP RenderGraph that can be added as a render feature to apply outlines to the entire scene. Note: This is not a per-object outline.Selective Layering: You can exclude specific layers from receiving outlines, useful for excluding complex geometries that don’t look good with outlines.URP RenderGraph Integration: I’ve commented most of the code to help you understand how it works, making it a learning resource for RenderGraph. The outline effect is built using the new URP RenderGraph system, which replaces older render features.High Performance: The effect is optimized into a single fullscreen blit, avoiding intermediate textures. However, keep in mind that screen-space outlines are inherently a relatively expensive effect.Multiple Filters Included: Choose from Roberts Cross, Sobel, Scharr, Simple Gradient, and Kirsch filters.For higher performance, a minimal version is also included, which generates outlines based only on normals and skips more expensive calculations.- Implementation using the URP Rendergraph system. Note that you can not combine Rendergraph features with legacy renderfeatures.- Excluding objects from outline via layering essentially renders them after the outline has rendered. To avoid rendering them twice you will have to remove them from the Opaque Layer Mask in the URP Renderer- Transparent Objects do not receive outlines as they are neither present in the depth texture nor in the normal texture- You can specify if you want the outline to appear in scene view or game view only- Settings are handeled through a scriptableobject, this allows for multiple presets to exist and allows cleaner access to the settings- A custom inspector provides details and displays errors in case something is off- The Fast Outline uses only normals and samples a lot less textures + avoids reconstructing world position for depth correction