Пример #1
0
        internal static void Render(MyUnorderedAccessTexture accumTarget, MyUnorderedAccessTexture coverageTarget)
        {
            ProfilerShort.Begin("Billboards");
            MyGpuProfiler.IC_BeginBlock("Billboards");
            if (MyRender11.MultisamplingEnabled)
            {
                MyBillboardRenderer.Render(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer), MyScreenDependants.m_resolvedDepth, MyScreenDependants.m_resolvedDepth.Depth);
            }
            else
            {
                MyBillboardRenderer.Render(MyGBuffer.Main.Get(MyGbufferSlot.LBuffer), MyGBuffer.Main.DepthStencil, MyGBuffer.Main.DepthStencil.Depth);
            }
            MyGpuProfiler.IC_EndBlock();

            // setup weighted blended OIT targets + blend states
            if (MyRender11.DebugOverrides.OIT)
            {
                SetupOIT(accumTarget, coverageTarget);
            }
            else
            {
                SetupStandard();
            }

            ProfilerShort.BeginNextBlock("GPU Particles");
            MyGpuProfiler.IC_BeginBlock("GPU Particles");
            if (MyRender11.DebugOverrides.GPUParticles)
            {
                if (MyRender11.MultisamplingEnabled)
                {
                    MyGPUParticleRenderer.Run(MyScreenDependants.m_resolvedDepth.Depth);
                }
                else
                {
                    MyGPUParticleRenderer.Run(MyGBuffer.Main.DepthStencil.Depth);
                }
            }
            MyGpuProfiler.IC_EndBlock();

            // resolve weighted blended OIT in  accum / coverage to LBuffer
            if (MyRender11.DebugOverrides.OIT)
            {
                ResolveOIT(accumTarget, coverageTarget);
            }

            ProfilerShort.BeginNextBlock("Atmosphere");
            MyGpuProfiler.IC_BeginBlock("Atmosphere");
            if (MyRender11.DebugOverrides.Atmosphere)
            {
                MyAtmosphereRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Clouds");
            MyGpuProfiler.IC_BeginBlock("Clouds");
            if (MyRender11.DebugOverrides.Clouds)
            {
                MyCloudRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.End();
        }
Пример #2
0
        internal static void Render(IRtvTexture gbuffer1Copy)
        {
            IBorrowedUavTexture accumTarget    = MyManagers.RwTexturesPool.BorrowUav("MyTransparentRendering.AccumTarget", Format.R16G16B16A16_Float);
            IBorrowedUavTexture coverageTarget = MyManagers.RwTexturesPool.BorrowUav("MyTransparentRendering.CoverageTarget", Format.R16_UNorm);

            ProfilerShort.Begin("Atmosphere");
            MyGpuProfiler.IC_BeginBlock("Atmosphere");
            if (MyRender11.DebugOverrides.Atmosphere)
            {
                MyAtmosphereRenderer.Render();
            }

            ProfilerShort.BeginNextBlock("Clouds");
            MyGpuProfiler.IC_BeginNextBlock("Clouds");
            if (MyRender11.DebugOverrides.Clouds)
            {
                MyCloudRenderer.Render();
            }
            MyGpuProfiler.IC_EndBlock();

            var depthResource = MyGBuffer.Main.ResolvedDepthStencil;

            // setup weighted blended OIT targets + blend states
            SetupTargets(accumTarget, coverageTarget, true);

            ProfilerShort.BeginNextBlock("Static glass");
            MyGpuProfiler.IC_BeginBlock("Static glass");
            m_glassWithDecals.Clear();
            MyStaticGlassRenderer.Render(HandleGlass);
            MyGpuProfiler.IC_EndBlock();

            ProfilerShort.BeginNextBlock("Billboards");
            MyGpuProfiler.IC_BeginBlock("Billboards");
            bool resetBindings = MyBillboardRenderer.Gather();

            if (resetBindings)
            {
                SetupTargets(accumTarget, coverageTarget, false);
            }

            MyBillboardRenderer.Render(depthResource.SrvDepth);

            ProfilerShort.BeginNextBlock("GPU Particles");
            MyGpuProfiler.IC_BeginNextBlock("GPU Particles");
            if (MyRender11.DebugOverrides.GPUParticles)
            {
                MyGPUParticleRenderer.Run(depthResource.SrvDepth, MyGBuffer.Main.GBuffer1);
            }
            MyGpuProfiler.IC_EndBlock();

            // Render decals on transparent surfaces in 2 steps: first far, second proximity
            float intervalMax = MyScreenDecals.VISIBLE_DECALS_SQ_TH;

            for (int it = 0; it < m_distances.Length; it++)
            {
                float intervalMin = m_distances[it];

                ProfilerShort.BeginNextBlock("Glass - Depth Only");
                MyGpuProfiler.IC_BeginBlock("Glass - Depth Only");
                bool glassFound = MyStaticGlassRenderer.RenderGlassDepthOnly(depthResource, gbuffer1Copy, intervalMin, intervalMax);
                MyGpuProfiler.IC_EndBlock();

                if (glassFound)
                {
                    SetupTargets(accumTarget, coverageTarget, false);

                    ProfilerShort.BeginNextBlock("Render decals - Transparent");
                    MyGpuProfiler.IC_BeginBlock("Render decals - Transparent");
                    MyScreenDecals.Draw(gbuffer1Copy, true, m_glassWithDecals);
                    MyGpuProfiler.IC_EndBlock();
                }

                intervalMax = intervalMin;
            }

            if (IsUsedOverlappingHeatMap())
            {
                DisplayOverlappingHeatMap(accumTarget, coverageTarget, MyRender11.Settings.DisplayTransparencyHeatMapInGrayscale);
            }

            MyGpuProfiler.IC_BeginBlock("OIT Resolve");
            // resolve weighted blended OIT in  accum / coverage to LBuffer
            if (MyRender11.DebugOverrides.OIT)
            {
                ResolveOIT(accumTarget, coverageTarget);
            }
            else
            {
                RC.SetRtv(null);
            }
            MyGpuProfiler.IC_EndBlock();

            coverageTarget.Release();
            accumTarget.Release();

            ProfilerShort.End();
        }