docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    AR Shader Occlusion component

    The ARShaderOcclusion component sets depth render texture information directly to global shader memory, instead of working through the AR Camera Background component. With shader occlusion, you're able to customize occlusion functionality by writing your own shaders. You can use the occlusion and confidence textures to apply techniques such as custom edge smoothing and visual effects.

    The AR Shader Occlusion component subscribes to AROcclusionManager.frameReceived to receive depth textures, then uses Shader.SetGlobalTexture to make occlusion textures globally available for use in shaders.

    AR Shader Occlusion component
    AR Shader Occlusion component.

    Add the AR Shader Occlusion component to your scene

    To enable shader occlusion, add the ARShaderOcclusion and AROcclusionManager to your Camera as outlined in Managers.

    Shader occlusion samples

    HMD occlusion shader example image
    HMD occlusion shader example image.

    For general information on writing shaders, consult the Writing shaders page in the Unity manual.

    The AR Foundation Samples app provides an example of how to use HMD occlusion with shaders in the HMD Occlusion sample scene.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)