public void RenderShadows(ScriptableRenderContext renderContext, CommandBuffer cmd, CullingResults cullResults, HDCamera hdCamera)
        {
            // Avoid to do any commands if there is no shadow to draw
            if (m_ShadowRequestCount == 0)
            {
                return;
            }

            // TODO remove DrawShadowSettings, lightIndex and splitData when scriptable culling is available
            ShadowDrawingSettings dss = new ShadowDrawingSettings(cullResults, 0);

            // Clear atlas render targets and draw shadows
            m_Atlas.RenderShadows(renderContext, cmd, dss);
            m_CascadeAtlas.RenderShadows(renderContext, cmd, dss);

            // If the shadow algorithm is the improved moment shadow
            if (GetDirectionaShadowAlgorithm() == DirectionalShadowAlgorithm.IMS)
            {
                m_CascadeAtlas.ComputeMomentShadows(cmd, hdCamera);
            }
        }
示例#2
0
        public void RenderShadows(ScriptableRenderContext renderContext, CommandBuffer cmd, CullingResults cullResults, HDCamera hdCamera)
        {
            // Avoid to do any commands if there is no shadow to draw
            if (m_ShadowRequestCount == 0)
            {
                return;
            }

            // TODO remove DrawShadowSettings, lightIndex and splitData when scriptable culling is available
            ShadowDrawingSettings dss = new ShadowDrawingSettings(cullResults, 0);

            dss.useRenderingLayerMaskTest = hdCamera.frameSettings.IsEnabled(FrameSettingsField.LightLayers);

            // Clear atlas render targets and draw shadows
            using (new ProfilingSample(cmd, "Punctual Lights Shadows rendering", CustomSamplerId.RenderShadows.GetSampler()))
            {
                m_Atlas.RenderShadows(renderContext, cmd, dss);
            }

            using (new ProfilingSample(cmd, "Directional Light Shadows rendering", CustomSamplerId.RenderShadows.GetSampler()))
            {
                m_CascadeAtlas.RenderShadows(renderContext, cmd, dss);
            }

            using (new ProfilingSample(cmd, "Area Light Shadows rendering", CustomSamplerId.RenderShadows.GetSampler()))
            {
                m_AreaLightShadowAtlas.RenderShadows(renderContext, cmd, dss);
                if (m_AreaLightShadowAtlas.HasBlurredEVSM())
                {
                    m_AreaLightShadowAtlas.AreaShadowBlurMoments(cmd, hdCamera);
                }
            }

            // If the shadow algorithm is the improved moment shadow
            if (GetDirectionalShadowAlgorithm() == DirectionalShadowAlgorithm.IMS)
            {
                m_CascadeAtlas.ComputeMomentShadows(cmd, hdCamera);
            }
        }