Installation
1. Import the Amplify Occlusion package into your project.
2. After Unity loads it will display the “Importing package” window, select All and click Import.
3. Amplify Occlusion should now be installed in your Unity project and it should have the following directory structure:
- YourProject\Assets\AmplifyOcclusion\
- YourProject\Assets\AmplifyOcclusion\Engine
- YourProject\Assets\AmplifyOcclusion\Universal
- YourProject\Assets\AmplifyOcclusion\Universal\Samples
Requirements
- Unity 2022.3 LTS or newer, including Unity 6.
- Universal Render Pipeline 14 or newer, set up as the active render pipeline of your project.
Workflow Overview
IMAGE PLACEHOLDER Volume override inspector with the Ambient Occlusion section and Intensity raised
1. Select the Universal Renderer asset used by your cameras and press Add Renderer Feature, then pick Amplify Occlusion.
2. On a Volume profile, press Add Override and pick Post-processing/Amplify Occlusion.
3. Enable Intensity and raise it above zero. The effect is skipped while Intensity is left at zero.
4. Adjust the radius, power exponent and blur values until you are satisfied with the results.
5. Optionally, add an Amplify Occlusion Instance component to a camera to choose how the occlusion is computed and applied on that camera, see Amplify Occlusion Instance.
The look of the effect lives in the Volume override, the technical choices live in the Instance on the camera. A camera without an Instance renders with the default settings.
Renderer Feature
The Renderer Feature registers Amplify Occlusion with the Universal Renderer. Only one Amplify Occlusion feature is allowed per renderer.
Motion Vectors
- Reprojects the temporal filter with the pipeline's motion vectors, which also follow moving objects, instead of the camera matrices alone. It needs the renderer's Copy Depth Mode set to After Opaques and the Apply Method set to Post Effect or Debug, otherwise it is ignored.
Ambient Occlusion Control
Amplify Occlusion offers two ways of applying the occlusion, set per camera on the Amplify Occlusion Instance. A Debug option is also available for added scene tweaking and flexibility.
IMAGE PLACEHOLDER Side by side comparison: Post Effect vs Injection
Post Effect
- The default. Resembles standard SSAO, it darkens the rendered image and applies the effect to all objects, ahead of the transparents.
Injection
- Injects the occlusion into the ambient lighting of the lit shaders, the same way Unity's own Screen Space Ambient Occlusion does, so only the indirect light is occluded and bright lit surfaces are preserved. Tint has no effect with Injection.
- Do not combine it with Unity's own Screen Space Ambient Occlusion feature on the same renderer, the scene would be occluded twice.
Debug
- Shows the occlusion alone over white, Multi-Bounce included when it is on.
Occlusion Parameters
These are set on the Amplify Occlusion Volume override. Each parameter has its own override checkbox, like any other Volume parameter.
Intensity
- Defines the intensity of the occlusion effect. It starts at zero, like every other override, so a fresh override does nothing until it is turned up.
Tint
- Defines the color of tint of the occlusion effect. Ignored by the Injection apply method.
Radius
- Defines the radius, or spread, of the occlusion effect, the blur amount is usually adjusted in relation to the spread size.
Power Exponent
- Defines the power exponent value of the occlusion effect, it allows you to easily exaggerate or reduce the overall strength.
Bias
- Occlusion bias, this value will directly influence which areas of your scene will display the effect.
Thickness
- Occlusion thickness heuristic, which allows for tweaking thin occluders such as vegetation. It only applies to the Heuristic thickness method of the GTAO technique. The Bitmask method and the CORTAO technique ignore it and use the per class Thickness of the Thickness Classes instead.
Direct Lighting Strength
- Only applies to the Injection apply method. Defines how much of the occlusion also darkens the direct light of lights, 0 (the default) leaves the direct lighting alone and occludes the ambient lighting only. Post Effect always darkens the whole frame.
Multi-Bounce
- Lightens the occlusion of bright surfaces by the light that would bounce between them, using the albedo of the GBuffer: per color with Post Effect, by luminance with Injection. Needs the Deferred rendering path, it has no effect on the Forward and Forward+ renderers.
- When used together with Indirect Lighting the first bounce is partly counted twice, so contacts on bright surfaces come out somewhat bright.
Unlit & Fwd-Only Receive
- Defines the share of the occlusion that Unlit materials take, 1 (the default) all of it, 0 none. The Deferred renderer cannot tell Unlit from Complex Lit and forward only materials, so these take it too. Applies to the Post Effect and Debug apply methods on the Deferred rendering path only. With Injection, Unlit materials follow Direct Lighting Strength.
Thickness Classes
Thickness Classes group renderers by their Rendering Layers into up to three classes, each with its own occlusion behavior. Set the Rendering Layers of your renderers, pick the same layers on a class, and its Receive, Occlude and Thickness settings then apply to them. The first class that has a layer in common with a renderer is its class. A class with no layers does nothing.
Layers
- The Rendering Layers of the class. A renderer on one of them is in the class.
Receive
- Share of the occlusion the class takes, 1 all of it, 0 none.
Occlude
- When off, the class casts no occlusion onto the rest of the scene. It still occludes itself.
Thickness
- Scales the slab the class occludes with, 1 leaves it as it is. Works with the Bitmask thickness method and the CORTAO technique only.
Requirements and notes
- Classes read the Rendering Layers texture, which URP writes with Use Rendering Layers turned on in the URP Asset (Lighting) on the Deferred rendering path, or with Decal Layers turned on in a Decal Renderer Feature. The inspector warns when no renderer writes the texture, the classes then have no effect.
- Every renderer starts on the Default rendering layer, so a class that includes Default applies to all renderers that were not moved to other layers.
- Unity stores the rendering layers in a float texture that loses precision from layer 21 up, so a renderer on layer 21 or above may end up in the wrong class. Keep such renderers off the layers your classes use, or move them below layer 21.
Distance Fade
The Distance Fade option provides a flexible method of fading the Intensity, Tint, Radius, Power Exponent and Thickness with distance.
Fade Enabled
- Enables the fade, the options below are only available when it is on.
Fade Start
- Distance, in units, where the fade starts.
Fade Length
- The length of the fade, in units, you can think of it as a feather effect.
Fade To Intensity
- The Intensity value to fade to. Keep in mind that you will be fading from the value set in the Occlusion Parameters to the value set here.
Fade To Tint
- The Tint value to fade to. Ignored by the Injection apply method.
Fade To Radius
Fade To Power Exponent
- The Power Exponent value to fade to.
Fade To Thickness
- The Thickness value to fade to. Ignored by the Bitmask method and the CORTAO technique, like Thickness.
Bilateral Blur Control
Amplify Occlusion uses an edge preserving bilateral blur to eliminate dithering artifacts, several options are available for added control.
Blur Enabled
- Smooths the occlusion with an edge preserving blur.
Blur Radius
- The radius of the blur effect applied, in screen pixels.
Blur Passes
- Defines the number of passes used for the effect, higher values are more performance intensive.
Blur Sharpness
- Provides control over the occlusion blur sharpness, 0 gives softer edges and 20 gives sharper edges.
Indirect Lighting
Adds short range indirect lighting: the color of nearby surfaces bleeding onto the ones they occlude, gathered along with the occlusion.
Enabled
- Turns Indirect Lighting on. It needs the Deferred rendering path, compute shaders, and the Post Effect or Injection apply method, it has no effect anywhere else.
- Post Effect gathers it from the current frame. Injection gathers it from the previous frame, so it follows the camera a frame late, adds it past the deferred lights, and does not support Render Graph yet.
- Multi-Bounce applies along with it, so the first bounce is partly counted twice and contacts on bright surfaces come out somewhat bright.
Intensity
- Scales the indirect lighting. 1 is the physically based amount.
Amplify Occlusion Instance
IMAGE PLACEHOLDER Amplify Occlusion Instance component on a camera
Amplify Occlusion Instance is an optional component. Add it to a camera to override how that camera's occlusion is computed and applied. The look of the effect stays in the Volume override. A camera without one renders with the defaults, Post Effect among them. The Scene View follows the camera the Game View shows: its Instance, or the defaults where it has none.
Apply Method
- How the occlusion is applied: Post Effect, Injection or Debug, see Ambient Occlusion Control. The inspector explains why the pipeline falls back to Post Effect when it cannot inject.
Sample Count
- Number of samples per pass: Low, Medium, High and Very High. Higher values will provide the best results at the cost of reduced performance. The default Medium value should suffice for most projects.
Technique
- How the occlusion is computed.
- GTAO (default), Ground Truth Ambient Occlusion, a horizon search along a few slices of the screen around each pixel. Thickness Method picks how its samples occlude what lies behind them.
- CORTAO, Circular Occluder Ray-Traced Ambient Occlusion. Every sample stands for a small sphere, and a set of rays over the hemisphere of the surface is tested against those spheres, so thin objects only darken what lies close behind them. Thickness and Thickness Method do not apply, the Volume's Thickness Classes scale the spheres per class instead.
- Indirect Lighting works with both.
Thickness Method
- How a sample occludes what lies behind it. GTAO technique only.
- Heuristic (default), treats every surface as solid behind it, scaled by the Volume's Thickness. It is the cheapest.
- Bitmask gives every sample a thickness of half the Radius, so thin objects such as poles, railings and foliage stop darkening what lies behind them and contacts tighten. It ignores Thickness, the Volume's Thickness Classes scale the slab per class instead. It costs more at the High and Very High sample counts. Pick Bitmask for scenes with thin geometry near the camera, or when dark halos show behind objects at large radii.
Normal Source
- Where the occlusion takes the surface normals from.
- Normals Texture (default) uses the pipeline's normals, with the detail of normal maps. On URP's Forward and Forward+ renderers it makes URP render a depth normals prepass, drawing the opaque objects again. On URP's Deferred renderer only the forward-only materials are drawn again.
- Depth rebuilds the normals from the depth, without the detail of normal maps and without any extra pass. Mainly for URP's Forward renderers when the prepass costs too much.
Full Resolution
- Computes the occlusion at full resolution. Off (the default) computes it at half the width and height, a quarter of the pixels, which is much cheaper with slightly softer contacts. A quick and efficient way to improve overall performance.
Temporal Filter
Amplify Occlusion uses temporal filtering to smooth the occlusion effect through the accumulation of occlusion calculations over time. Each frame needs fewer samples and the noise settles into a smooth result, improving the quality of the effect with a slight performance trade-off and possible ghosting.
Enabled
- Turns the temporal filter on. It is on by default.
Blending
- Controls the overall accumulation decay, from 0 to 1 (default 0.8), by defining how much of the history each frame keeps. Higher values settle the noise more at the expense of possible ghosting behind moving objects, lower values react faster but flicker more.
Response
- Controls how readily camera and object motion discard the history, from 0 to 1 (default 0.5). Higher values discard it sooner, giving less ghosting but more noise in motion, lower values keep it longer.
Technical Considerations
Player Builds
Injection works in player builds as is. The lit shaders only read the occlusion in their _SCREEN_SPACE_OCCLUSION variants, which URP strips from builds with Strip Unused Variants on (the default) unless a renderer has its own Screen Space Ambient Occlusion active. Amplify Occlusion keeps those variants for every URP asset with a renderer that carries the Amplify Occlusion feature. It costs nothing per frame, only some 1 to 10 percent more shader variants in the build.
Per-camera Settings
The volume stack is global, so every camera rendering through a Universal Renderer that carries the feature renders the effect once an override is active. To keep a specific camera out of it, have it render through a separate renderer without the feature.
XR
The effect renders on XR cameras in Multi Pass and in Single Pass Instanced, with every feature and Indirect Lighting included, on Unity 2022.3 and on Unity 6 in both Render Graph and compatibility mode.
What is not supported yet: Single Pass with the multiview extension, which URP takes on devices that have it, foveated rendering, and both eyes rendering into one shared texture. An XR camera that uses one of them renders without the effect, with a warning in the Console.
Deferred Only Features
Indirect Lighting, Multi-Bounce and Unlit & Fwd-Only Receive need the Deferred rendering path. They have no effect on the Forward and Forward+ renderers, the inspector warns when that is the case. Indirect Lighting additionally needs compute shaders.
Troubleshooting
Nothing renders at all
- The Amplify Occlusion Renderer Feature is most likely missing from every Universal Renderer in use. The Amplify Occlusion volume override and Amplify Occlusion Instance inspectors both warn when that is the case.
- The effect is skipped while Intensity is left at zero.
Injection looks the same as Post Effect, or falls back to Post Effect
- Check the notes on the Apply Method row of the Amplify Occlusion Instance, they say why the pipeline cannot inject.
The scene is occluded twice
- Unity's own Screen Space Ambient Occlusion feature is active on the same renderer as Injection. Remove one of them.
Thickness Classes have no effect
Indirect Lighting or Multi-Bounce have no effect
|