Skip to content

Order-independent Transparency Implementation in Unity with Per-Pixel Linked Lists

License

Notifications You must be signed in to change notification settings

Scarabay/oit-per-pixel-linked-list

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Order-independent Transparency in Unity using Per-Pixel Linked Lists

Animation2


Animation Animation2

Both animations show three stacked transparent cubes. The first one with this implementation of order-independent transparency and correct color blending. The second one is rendered with the standard shader.

Description

This is an implementation of order-independent transparency in Unity's Built-In Pipeline. It uses Per-Pixel Linked Lists, implemented with RWStructuredBuffers. This is a feature requiring Shader Model 5.0 with ComputeBuffers, see the Unity Manual for supported platforms. For reference a presentation by Holger Gruen and Nicolas Thibieroz was used. The code is based on their suggestions.

Usage

I recommend using this with the package Post-Processing Stack v2, because then transparent objects will be rendered in Scene View as well. Follow these steps:

  1. Add the post-processing override Order Independent Transparency PP to a global post-processing volume in your scene.
  2. Change the shaders of every object that shall be rendered with order-independent transparency. They have to have a material using a custom shader. Two sample shaders that you can use are included in this project OrderIndependentTransparency/Unlit and OrderIndependentTransparency/Standard.
  3. Run your scene.

Without Post-Processing Stack v2

If you don't want to use the post-processing stack just skip the first step and instead add the component OrderIndependentTransparency to a camera. Using this component transparent objects won't render in the editor scene view though.

Notes

Note that this project currently does not include implementations for the Universal Render-Pipeline and the High-Definition Render-Pipeline.

About

Order-independent Transparency Implementation in Unity with Per-Pixel Linked Lists

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • ShaderLab 54.2%
  • C# 30.7%
  • HLSL 15.1%