コード例 #1
0
        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);
            }
        }
コード例 #2
0
        internal static void PrepareCulling()
        {
            m_cullQuery.Reset();
            m_wavefront.Clear();

            // add main camera
            AddCamera(ref MyEnvironment.ViewD, ref MyEnvironment.OriginalProjectionD,
                      new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y),
                      MyGBuffer.Main);
            m_cullQuery.FrustumQueries[m_wavefront.Count - 1].Type = MyFrustumEnum.MainFrustum;

            MyShadows.PrepareShadowmaps();
            foreach (var query in MyShadows.ShadowMapQueries)
            {
                bool isCascade = query.QueryType == MyFrustumEnum.ShadowCascade;
                AddShadowCaster(new BoundingFrustumD(query.ProjectionInfo.WorldToProjection), query.ProjectionInfo.CurrentLocalToProjection, query.Viewport, query.DepthBuffer, isCascade, query.QueryType.ToString());

                if (isCascade)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = query.ProjectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.ShadowCascadeSmallSkipThresholds[query.CascadeIndex];
                    m_cullQuery.FrustumQueries[m_wavefront.Count - 1].SmallObjects = smallCulling;
                    m_cullQuery.FrustumQueries[m_wavefront.Count - 1].CascadeIndex = query.CascadeIndex;
                }

                m_cullQuery.FrustumQueries[m_wavefront.Count - 1].Type    = query.QueryType;
                m_cullQuery.FrustumQueries[m_wavefront.Count - 1].Ignored = query.IgnoredEntities;
            }
        }
コード例 #3
0
        internal static void PrepareCulling()
        {
            m_cullQuery.Reset();
            m_wavefront.Clear();

            // add main camera
            AddCamera(ref MyEnvironment.View, ref MyEnvironment.Projection,
                      new MyViewport(MyRender11.ViewportResolution.X, MyRender11.ViewportResolution.Y),
                      MyGBuffer.Main);
            m_cullQuery.FrustumQuery[m_wavefront.Count - 1].Type = MyFrustumEnum.MainFrustum;

            MyShadows.ResetShadowmaps();
            foreach (var query in MyShadows.ShadowmapList)
            {
                bool isCascade = query.QueryType == MyFrustumEnum.Cascade0 || query.QueryType == MyFrustumEnum.Cascade1 || query.QueryType == MyFrustumEnum.Cascade2 || query.QueryType == MyFrustumEnum.Cascade3;
                AddShadowCaster(new BoundingFrustum(query.ProjectionInfo.WorldToProjection), query.ProjectionInfo.CurrentLocalToProjection, query.Viewport, query.DepthBuffer, isCascade, query.QueryType.ToString());

                if (query.QueryType == MyFrustumEnum.Cascade0)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade0SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }
                else if (query.QueryType == MyFrustumEnum.Cascade1)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade1SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }
                else if (query.QueryType == MyFrustumEnum.Cascade2)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade2SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }
                else if (query.QueryType == MyFrustumEnum.Cascade3)
                {
                    var smallCulling = new MyCullingSmallObjects();
                    smallCulling.ProjectionDir    = query.ProjectionDir;
                    smallCulling.ProjectionFactor = 1;// query.projectionFactor;
                    smallCulling.SkipThreshhold   = MyRender11.Settings.Cascade3SmallSkip;
                    m_cullQuery.FrustumQuery[m_wavefront.Count - 1].SmallObjects = smallCulling;
                }

                m_cullQuery.FrustumQuery[m_wavefront.Count - 1].Type    = query.QueryType;
                m_cullQuery.FrustumQuery[m_wavefront.Count - 1].Ignored = query.IgnoredEntities;
            }
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
        }