예제 #1
0
        // Here you can inject one or multiple render passes in the renderer.
        // This method is called when setting up the renderer once per-camera.
        public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
        {
            shader = Shader.Find("Hidden/Universal Render Pipeline/HBAO");
            if (shader == null)
            {
                Debug.LogWarning("HBAO shader was not found. Please ensure it compiles correctly");
                return;
            }

            if (renderingData.cameraData.postProcessEnabled)
            {
                m_HBAORenderPass.Setup(shader, renderer, renderingData);
                renderer.EnqueuePass(m_HBAORenderPass);
            }
        }
예제 #2
0
    // Here you can inject one or multiple render passes in the renderer.
    // This method is called when setting up the renderer once per-camera.
    public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
    {
        if (settings == null)
        {
            Debug.LogWarning("Please attach HBAORendererSettings to settings field");
            return;
        }

        if (hbaoShader == null)
        {
            hbaoShader = Shader.Find(SHADER_PATH);
            if (hbaoShader == null)
            {
                Debug.LogWarning("HBAO shader was not found. Please ensure it compiles correctly");
                return;
            }
        }

        if (!settings.enable)
        {
            return;
        }

        // Configures where the render pass should be injected.
        m_HBAORenderPass.renderPassEvent = settings.displayMode == DisplayMode.Normal ?
                                           RenderPassEvent.BeforeRenderingTransparents :
                                           RenderPassEvent.AfterRenderingTransparents;

        m_HBAORenderPass.settings = settings;

        var material = CoreUtils.CreateEngineMaterial(hbaoShader);

        m_HBAORenderPass.Setup(material, renderer.cameraColorTarget);

        renderer.EnqueuePass(m_HBAORenderPass);
    }