Skip to content

Unity screen space outlines for the Universal Render Pipeline, written with rendergraph

License

Notifications You must be signed in to change notification settings

AtanGames/unity-outline-urp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Unity Outline URP (Render Graph)

Unity screen-space outlines for the Universal Render Pipeline (URP) using a lightweight Scriptable Renderer Feature and Render Graph pass.

If you are searching for terms like "Unity URP outline shader", "screen space outlines Unity", or "URP edge detection shader", this repository is a minimal, production-friendly starting point.

This repo is the free/minimal variant of Atan Outline Pro. Full version: https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/atan-outline-urp-321755

Unity URP outline effect diagram

Features

  • Screen-space outlines in URP (post-style edge effect).
  • ✅ Built with Render Graph (RecordRenderGraph) for modern URP pipelines.
  • ✅ Uses camera normal texture for clean geometric edge detection.
  • Roberts cross filter style normal-based edge detection in shader.
  • ✅ Exposed controls:
    • Normal Threshold
    • Outline Size
    • Outline Color (with alpha blending)
  • ✅ Lightweight implementation with a small C# + shader footprint.

How it works

  1. A custom ScriptableRendererFeature (OutlineFeatureLite) adds a render pass.
  2. The pass requests Color + Normal inputs.
  3. The shader samples _CameraNormalsTexture and _CameraOpaqueTexture.
  4. It computes normal discontinuity (edge strength) and blends OutlineColor over the camera color.

This provides a stylized toon/cartoon-like outline effect without per-object outline meshes.

Compatibility

  • Unity: intended for recent Unity versions that support URP Render Graph path.
  • Pipeline: Universal Render Pipeline (URP).
  • Injection point: BeforeRenderingTransparents.
  • Camera type: Game camera.

Installation

Option A: Copy into your project

  1. Copy the AtanOutlineLite folder into your Unity project (for example under Assets/).
  2. Ensure URP is set up in your project.

Option B: Use as a Git submodule/package source

Add this repository and reference the folder contents in your project workflow.

Setup (URP Renderer)

  1. Open your URP Renderer asset (Forward Renderer/Universal Renderer).
  2. Add OutlineFeatureLite to the renderer features list.
  3. Assign the included OutlineMaterialLite (or create a material with AtanOutlineLite/OutlineShader).
  4. Tune:
    • Normal Threshold (higher = fewer edges)
    • Outline Size (pixel-radius sampling amount)
    • Outline Color (alpha controls blend strength)

Shader and script overview

  • AtanOutlineLite/Scripts/OutlineFeatureLite.cs
    • Registers the pass and configures required inputs.
  • AtanOutlineLite/Scripts/OutlinePass.cs
    • Pushes runtime parameters to material and performs blit in Render Graph.
  • AtanOutlineLite/Scripts/OutlineSettings.cs
    • Serializable settings for threshold, size, and color.
  • AtanOutlineLite/Shaders/OutlineShader.shader
    • Full-screen outline shader using normal-based edge detection.

Performance notes

  • This is a full-screen pass, so cost scales with resolution.
  • Larger outline sizes increase sampling distance and visual thickness.
  • Best results come from balancing threshold and size for your scene style.

Use cases

  • Toon/cel-shaded games
  • Object readability in complex scenes
  • Stylized rendering pipelines
  • Prototype-friendly NPR effects

License

See LICENSE.

About

Unity screen space outlines for the Universal Render Pipeline, written with rendergraph

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published