Beispiel #1
0
 static void ExecuteSSShadowDirectional(CommandBuffer cmd, SSShadowDirectionalParameters sssdParams, RTHandle textureArray)
 {
     // If it is screen space but not ray traced, then we can rely on the shadow map
     // WARNING: This pattern only works because we can only have one directional and the directional shadow is evaluated first.
     CoreUtils.SetRenderTarget(cmd, textureArray, depthSlice: sssdParams.depthSlice);
     HDUtils.DrawFullScreen(cmd, s_ScreenSpaceShadowsMat, textureArray);
 }
Beispiel #2
0
        SSShadowDirectionalParameters PrepareSSShadowDirectionalParameters()
        {
            SSShadowDirectionalParameters sssdParams = new SSShadowDirectionalParameters();

            sssdParams.depthSlice = m_CurrentSunLightDirectionalLightData.screenSpaceShadowIndex;
            return(sssdParams);
        }
Beispiel #3
0
        void RenderDirectionalLightScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera)
        {
            // Should we be executing anything really?
            bool screenSpaceShadowRequired = m_CurrentSunLightAdditionalLightData != null && m_CurrentSunLightAdditionalLightData.WillRenderScreenSpaceShadow();

            // Render directional screen space shadow if required
            if (screenSpaceShadowRequired)
            {
                using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.RaytracingDirectionalLightShadow)))
                {
                    bool rayTracedDirectionalRequired = m_CurrentSunLightAdditionalLightData.WillRenderRayTracedShadow();
                    // If the shadow is flagged as ray traced, we need to evaluate it completely
                    if (rayTracedDirectionalRequired)
                    {
                        RenderRayTracedDirectionalScreenSpaceShadow(cmd, hdCamera);
                    }
                    else
                    {
                        SSShadowDirectionalParameters sssdParams = PrepareSSShadowDirectionalParameters();
                        ExecuteSSShadowDirectional(cmd, sssdParams, m_ScreenSpaceShadowTextureArray);
                    }
                }
            }
        }