예제 #1
0
            internal bool Setup(ScreenSpaceAmbientOcclusionSettings featureSettings, ScriptableRenderer renderer)
            {
                this.renderPassEvent = featureSettings.AfterOpaque ? RenderPassEvent.AfterRenderingOpaques : RenderPassEvent.AfterRenderingGbuffer;

                m_Renderer        = renderer;
                m_CurrentSettings = featureSettings;

                ScreenSpaceAmbientOcclusionSettings.DepthSource source = this.isRendererDeferred
                    ? ScreenSpaceAmbientOcclusionSettings.DepthSource.DepthNormals
                    : m_CurrentSettings.Source;

                switch (source)
                {
                case ScreenSpaceAmbientOcclusionSettings.DepthSource.Depth:
                    ConfigureInput(ScriptableRenderPassInput.Depth);
                    break;

                case ScreenSpaceAmbientOcclusionSettings.DepthSource.DepthNormals:
                    ConfigureInput(ScriptableRenderPassInput.Normal);    // need depthNormal prepass for forward-only geometry
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                return(material != null &&
                       m_CurrentSettings.Intensity > 0.0f &&
                       m_CurrentSettings.Radius > 0.0f &&
                       m_CurrentSettings.SampleCount > 0);
            }
            internal ScreenSpaceAmbientOcclusionPass()
            {
                m_CurrentSettings = new ScreenSpaceAmbientOcclusionSettings();

                m_SSAOTexture1     = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTexture1ID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture1");
                m_SSAOTexture2     = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTexture2ID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture2");
                m_SSAOTexture3     = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTexture3ID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture3");
                m_SSAOTextureFinal = RTHandles.Alloc(new RenderTargetIdentifier(s_SSAOTextureFinalID, 0, CubemapFace.Unknown, -1), "_SSAO_OcclusionTexture");
            }
            internal bool Setup(ScreenSpaceAmbientOcclusionSettings featureSettings)
            {
                m_CurrentSettings = featureSettings;
                switch (m_CurrentSettings.Source)
                {
                case ScreenSpaceAmbientOcclusionSettings.DepthSource.Depth:
                    ConfigureInput(ScriptableRenderPassInput.Depth);
                    break;

                case ScreenSpaceAmbientOcclusionSettings.DepthSource.DepthNormals:
                    ConfigureInput(ScriptableRenderPassInput.Normal);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                return(material != null &&
                       m_CurrentSettings.Intensity > 0.0f &&
                       m_CurrentSettings.Radius > 0.0f &&
                       m_CurrentSettings.SampleCount > 0);
            }
예제 #4
0
            internal bool Setup(ScreenSpaceAmbientOcclusionSettings featureSettings, ScriptableRenderer renderer, Material material)
            {
                m_Material        = material;
                m_Renderer        = renderer;
                m_CurrentSettings = featureSettings;

                ScreenSpaceAmbientOcclusionSettings.DepthSource source;
                if (isRendererDeferred)
                {
                    renderPassEvent = featureSettings.AfterOpaque ? RenderPassEvent.AfterRenderingOpaques : RenderPassEvent.AfterRenderingGbuffer;
                    source          = ScreenSpaceAmbientOcclusionSettings.DepthSource.DepthNormals;
                }
                else
                {
                    // Rendering after PrePasses is usually correct except when depth priming is in play:
                    // then we rely on a depth resolve taking place after the PrePasses in order to have it ready for SSAO.
                    // Hence we set the event to RenderPassEvent.AfterRenderingPrePasses + 1 at the earliest.
                    renderPassEvent = featureSettings.AfterOpaque ? RenderPassEvent.AfterRenderingOpaques : RenderPassEvent.AfterRenderingPrePasses + 1;
                    source          = m_CurrentSettings.Source;
                }


                switch (source)
                {
                case ScreenSpaceAmbientOcclusionSettings.DepthSource.Depth:
                    ConfigureInput(ScriptableRenderPassInput.Depth);
                    break;

                case ScreenSpaceAmbientOcclusionSettings.DepthSource.DepthNormals:
                    ConfigureInput(ScriptableRenderPassInput.Normal);    // need depthNormal prepass for forward-only geometry
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                return(m_Material != null &&
                       m_CurrentSettings.Intensity > 0.0f &&
                       m_CurrentSettings.Radius > 0.0f &&
                       m_CurrentSettings.SampleCount > 0);
            }
예제 #5
0
 internal ScreenSpaceAmbientOcclusionPass()
 {
     m_CurrentSettings = new ScreenSpaceAmbientOcclusionSettings();
 }