> For the complete documentation index, see [llms.txt](https://graphicscat.gitbook.io/graphicscat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://graphicscat.gitbook.io/graphicscat/documentation/occlusion-vision.md).

# Occlusion Vision

## Solution Overview

* This solution implements an occlusion-aware rendering system built on the URP framework, capable of displaying silhouettes of objects behind occluders.
* The effects are customizable. It comes with several built-in occlusion effects and supports user-defined custom effects.
* It's simple to use; just place the system's prefab into your scene, and it's ready to go.
* It has a low performance overhead, supports batching, and uses lightweight shaders, making it suitable for mobile platforms.

## Feature Support

* Supports configuring the LayerMask and Color for objects with occlusion effects.
* Supports grouping, allowing different groups to have unique configurations and styles.
* Includes several built-in standard occlusion effects.
* Allows for custom occlusion effects using user-defined shaders.

## Built-in Effects

* SolidColor
* DitherPattern
* Fresnel
* Outline

## How to Use

* Copy the `OcclusionVision` Prefab from the package.
* Configure the prefab's parameters and add it to your scene.
* You can create different copies to meet the needs of various scenarios.

<figure><img src="/files/dO7sUqt90POjU3yFHpx1" alt=""><figcaption></figcaption></figure>

## Parameter Description

* LayerMask: Specifies which objects should have the occlusion effect applied.
* Color (RGBA): The color of the occlusion effect (supports transparency).
* Intensity: The intensity of the occlusion effect's color.
* Shader: The shader that implements the occlusion effect. Built-in effects will set this automatically, while custom effects require manual assignment.

## Custom Effects

* Refer to `CustomExample.shader` for guidance on writing your own shader.
* Configure the `Occlusion Vision Group` parameters:
  * Style: Select `Custom`.
  * Shader: Assign your custom shader.

<figure><img src="/files/KWG1xA1llNXoYodlIVlI" alt=""><figcaption></figcaption></figure>

## Performance Details

* Batch count will increase, but it supports SRP batching.
* Batching Overhead: `SolidColor` = `Fresnel` = `DitherPattern` < `Outline` (Low)
* Shader Overhead: `SolidColor` (Very Low) < `Outline` (Low) < `Fresnel` (Low) < `DitherPattern` (Medium)
* Recommended for use on a reasonable number of objects, not hundreds or more.

## Performance Scaling

* Very Low: Disable the effect if there are more than 10 occluded objects.
* Low: Disable the effect if there are more than 50 occluded objects.
* Medium: Disable the effect if there are more than 100 occluded objects.
* High: Disable the effect if there are more than 200 occluded objects.
* Flagship: Disable the effect if there are more than 300 occluded objects.

## Enjoying this package? <a href="#lmfg-1756996814992" id="lmfg-1756996814992"></a>

* Give it a quick rating or leave a short review on the Unity Asset Store.
* Your feedback helps us improve and add even more features!
* [Review on Unity Asset Store](https://assetstore.unity.com/packages/slug/327956)
