internal static void PrepareCullQuery(MyCullQuery cullQuery, ListReader <MyShadowmapQuery> shadowmapQueries, bool updateEnvironmentMap) { cullQuery.AddMainViewPass(new MyViewport(MyRender11.ViewportResolution), MyGBuffer.Main); foreach (var shadowmapQuery in shadowmapQueries) { bool isCascade = shadowmapQuery.QueryType == MyFrustumEnum.ShadowCascade; var matrix = shadowmapQuery.ProjectionInfo.WorldToProjection; cullQuery.AddDepthPass(ref matrix, shadowmapQuery.ProjectionInfo.CurrentLocalToProjection, shadowmapQuery.Viewport, shadowmapQuery.DepthBuffer, isCascade, ToString(shadowmapQuery.QueryType)); if (isCascade) { var smallCulling = new MyCullingSmallObjects { ProjectionDir = shadowmapQuery.ProjectionDir, ProjectionFactor = shadowmapQuery.ProjectionFactor, SkipThreshold = MyRenderProxy.Settings.ShadowCascadeSmallSkipThresholds[shadowmapQuery.CascadeIndex] }; cullQuery.FrustumCullQueries[cullQuery.Size - 1].SmallObjects = smallCulling; cullQuery.FrustumCullQueries[cullQuery.Size - 1].CascadeIndex = shadowmapQuery.CascadeIndex; } cullQuery.FrustumCullQueries[cullQuery.Size - 1].Type = shadowmapQuery.QueryType; cullQuery.FrustumCullQueries[cullQuery.Size - 1].Ignored = shadowmapQuery.IgnoredEntities; } if (updateEnvironmentMap) { MyEnvironmentProbe.UpdateEnvironmentProbes(cullQuery); } }
static void AddShadowmapQueryIntoCullQuery(MyCullQuery cullQuery, MyShadowmapQuery shadowmapQuery) { cullQuery.AddDepthPass(shadowmapQuery); if (shadowmapQuery.QueryType == MyFrustumEnum.ShadowCascade) { var smallCulling = new MyCullingSmallObjects { ProjectionFactor = shadowmapQuery.ProjectionFactor, // <- this disables culling of objects depending on the previous cascade SkipThreshold = MyManagers.Shadow.GetSettingsSmallObjectSkipping(shadowmapQuery.Index), }; cullQuery.FrustumCullQueries[cullQuery.Size - 1].SmallObjects = smallCulling; } cullQuery.FrustumCullQueries[cullQuery.Size - 1].Type = shadowmapQuery.QueryType; cullQuery.FrustumCullQueries[cullQuery.Size - 1].Index = shadowmapQuery.Index; cullQuery.FrustumCullQueries[cullQuery.Size - 1].Ignored = shadowmapQuery.IgnoredEntities; }
static void AddShadowmapQueryIntoCullQuery(MyCullQuery cullQuery, MyShadowmapQuery shadowmapQuery) { bool isCascade = shadowmapQuery.QueryType == MyFrustumEnum.ShadowCascade; var matrix = shadowmapQuery.ProjectionInfo.WorldToProjection; cullQuery.AddDepthPass(ref matrix, shadowmapQuery.ProjectionInfo.CurrentLocalToProjection, shadowmapQuery.Viewport, shadowmapQuery.DepthBuffer, isCascade, ToString(shadowmapQuery.QueryType)); if (isCascade) { var smallCulling = new MyCullingSmallObjects { ProjectionFactor = shadowmapQuery.ProjectionFactor, // <- this disables culling of objects depending on the previous cascade SkipThreshold = MyManagers.Shadow.GetSettingsSmallObjectSkipping(shadowmapQuery.CascadeIndex), }; cullQuery.FrustumCullQueries[cullQuery.Size - 1].SmallObjects = smallCulling; cullQuery.FrustumCullQueries[cullQuery.Size - 1].CascadeIndex = shadowmapQuery.CascadeIndex; } cullQuery.FrustumCullQueries[cullQuery.Size - 1].Type = shadowmapQuery.QueryType; cullQuery.FrustumCullQueries[cullQuery.Size - 1].Ignored = shadowmapQuery.IgnoredEntities; }
internal static void PrepareCullQuery(MyCullQuery cullQuery, ListReader<MyShadowmapQuery> shadowmapQueries, bool updateEnvironmentMap) { cullQuery.AddMainViewPass(new MyViewport(MyRender11.ViewportResolution), MyGBuffer.Main); foreach (var shadowmapQuery in shadowmapQueries) { bool isCascade = shadowmapQuery.QueryType == MyFrustumEnum.ShadowCascade; var matrix = shadowmapQuery.ProjectionInfo.WorldToProjection; cullQuery.AddDepthPass(ref matrix, shadowmapQuery.ProjectionInfo.CurrentLocalToProjection, shadowmapQuery.Viewport, shadowmapQuery.DepthBuffer, isCascade, ToString(shadowmapQuery.QueryType)); if (isCascade) { var smallCulling = new MyCullingSmallObjects { ProjectionDir = shadowmapQuery.ProjectionDir, ProjectionFactor = shadowmapQuery.ProjectionFactor, SkipThreshold = MyRenderProxy.Settings.ShadowCascadeSmallSkipThresholds[shadowmapQuery.CascadeIndex] }; cullQuery.FrustumCullQueries[cullQuery.Size - 1].SmallObjects = smallCulling; cullQuery.FrustumCullQueries[cullQuery.Size - 1].CascadeIndex = shadowmapQuery.CascadeIndex; } cullQuery.FrustumCullQueries[cullQuery.Size - 1].Type = shadowmapQuery.QueryType; cullQuery.FrustumCullQueries[cullQuery.Size - 1].Ignored = shadowmapQuery.IgnoredEntities; } if (updateEnvironmentMap) MyEnvironmentProbe.UpdateEnvironmentProbes(cullQuery); }