Esempio n. 1
0
        void PostprocessProbe(int nProbe)
        {
            var matrix = CubeFaceViewMatrix(Vector3.Zero, nProbe);

            MyEnvProbeProcessing.RunForwardPostprocess(m_workCubemap.SubresourceRtv(nProbe),
                                                       CubemapDepth.SubresourceSrv(nProbe), ref matrix, MyAtmosphereRenderer.GetCurrentAtmosphereId());
        }
Esempio n. 2
0
        void PostprocessProbe(int nProbe)
        {
            var viewMatrix = CubeFaceViewMatrix(Vector3.Zero, nProbe);
            var projMatrix = GetProjectionMatrixInfinite();

            MyEnvProbeProcessing.RunForwardPostprocess(m_workCubemap.SubresourceRtv(nProbe),
                                                       CubemapDepth.SubresourceDsv(nProbe), CubemapDepth.SubresourceSrv(nProbe),
                                                       ref viewMatrix, ref projMatrix);
        }
Esempio n. 3
0
        internal static unsafe void InitSubsystems()
        {
            InitializeBlendStates();
            InitializeRasterizerStates();
            InitilizeSamplerStates();

            MyCommon.Init();
            MyPipelineStates.Init();
            MyTextures.Init();
            MyVertexLayouts.Init();
            MyShaders.Init();
            MyRwTextures.Init();
            MyHwBuffers.Init();
            MyMeshes.Init();
            MyMeshTableSRV.Init();
            MyMergeInstancing.Init();
            MyGeometryRenderer.Init();
            MyLightRendering.Init();
            MyShadows.Init();
            MyLinesRenderer.Init();
            MySpritesRenderer.Init();
            MyPrimitivesRenderer.Init();
            MyFoliageRenderer.Init();
            MyOutline.Init();

            MyComponents.Init();

            MyBillboardRenderer.Init(); // hardcoded limits
            MyDebugRenderer.Init();
            MyGPUFoliageGenerating.Init();

            MyScreenDecals.Init();
            MyEnvProbeProcessing.Init();
            MyShadowsResolve.Init();
            MyAtmosphereRenderer.Init();
            MyAAEdgeMarking.Init();
            MyScreenPass.Init();
            MyCopyToRT.Init();
            MyBlendTargets.Init();
            MyFXAA.Init();
            MyDepthResolve.Init();
            MyBloom.Init();
            MyLuminanceAverage.Init();
            MyToneMapping.Init();
            MySSAO.Init();
            MyHdrDebugTools.Init();

            MySceneMaterials.Init();
            MyMaterials1.Init();
            MyVoxelMaterials1.Init();
            MyMeshMaterials1.Init();

            //MyShaderFactory.RunCompilation(); // rebuild
        }
Esempio n. 4
0
        internal static unsafe void InitSubsystems()
        {
            MyRwTextures.Init();
            MyHwBuffers.Init();
            MyPipelineStates.Init();
            ResetShadows(MyRenderProxy.Settings.ShadowCascadeCount, RenderSettings.ShadowQuality.ShadowCascadeResolution());
            MyRender11.Init();
            MyCommon.Init();
            SamplerStates.Init();
            MyDepthStencilState.Init();
            MyTextures.Init();
            MyVertexLayouts.Init();
            MyShaders.Init();
            MyMeshes.Init();
            MyMeshTableSRV.Init();
            MyLightRendering.Init();
            MyLinesRenderer.Init();
            MySpritesRenderer.Init();
            MyPrimitivesRenderer.Init();
            MyOutline.Init();
            MyBlur.Init();
            MyTransparentRendering.Init();

            MyFoliageComponents.Init();

            MyBillboardRenderer.Init(); // hardcoded limits
            MyDebugRenderer.Init();

            MyScreenDecals.Init();
            MyEnvProbeProcessing.Init();
            MyAtmosphereRenderer.Init();
            MyCloudRenderer.Init();
            MyAAEdgeMarking.Init();
            MyScreenPass.Init();
            MyCopyToRT.Init();
            MyBlendTargets.Init();
            MyFXAA.Init();
            MyDepthResolve.Init();
            MyBloom.Init();
            MyLuminanceAverage.Init();
            MyToneMapping.Init();
            MySSAO.Init();
            MyPlanetBlur.Init();
            MyHdrDebugTools.Init();

            MySceneMaterials.Init();
            MyMaterials1.Init();
            MyVoxelMaterials1.Init();
            MyMeshMaterials1.Init();
        }
Esempio n. 5
0
        void BlendAllProbes()
        {
            float blendWeight =
                (float)Math.Min((MyRender11.CurrentDrawTime - m_lastUpdateTime).Seconds / MAX_BLEND_TIME_S, 1);

            if (blendWeight < 1)
            {
                MyEnvProbeProcessing.Blend(Cubemap, m_prevWorkCubemapPrefiltered, m_workCubemapPrefiltered, blendWeight);
            }
            else if (blendWeight == 1)
            {
                MyImmediateRC.RC.CopyResource(m_workCubemapPrefiltered, m_prevWorkCubemapPrefiltered);
                MyImmediateRC.RC.CopyResource(m_workCubemapPrefiltered, Cubemap);
            }
        }
Esempio n. 6
0
            internal void UpdateBlending()
            {
                if (state == 12 && blendWeight < 1)
                {
                    blendWeight = (float)Math.Min((MyRender11.CurrentDrawTime - blendT0).Seconds / MaxBlendTimeS, 1);

                    MyEnvProbeProcessing.Blend(cubemapPrefiltered, prevWorkCubemapPrefiltered, workCubemapPrefiltered, blendWeight);
                    m_envProbe.lastUpdateTime = MyRender11.CurrentDrawTime;
                }

                if (state == 12 && blendWeight == 1)
                {
                    state = 0;
                    MyImmediateRC.RC.Context.CopyResource(workCubemapPrefiltered.Resource, prevWorkCubemapPrefiltered.Resource);
                    blendWeight = 0;
                }
            }
        internal void UpdateBlending()
        {
            if (state == 12 && blendWeight < 1)
            {
                blendWeight = (float)Math.Min((MyRender11.CurrentDrawTime - blendT0).Seconds / MaxBlendTimeS, 1);

                MyEnvProbeProcessing.Blend(cubemapPrefiltered, prevWorkCubemapPrefiltered, workCubemapPrefiltered, blendWeight);
                Instance.lastUpdateTime = MyRender11.CurrentDrawTime;
            }

            if (state == 12 && blendWeight == 1)
            {
                state = 0;
                MyImmediateRC.RC.DeviceContext.CopyResource(workCubemapPrefiltered.Resource, prevWorkCubemapPrefiltered.Resource);
                blendWeight = 0;
            }

            //    Texture2D.ToFile(MyImmediateRC.RC.Context, workCubemap.Resource, ImageFileFormat.Dds, "c:\\environment.dds");
        }
Esempio n. 8
0
            internal void StepUpdateFiltering()
            {
                if (6 <= state && state < 12)
                {
                    int faceId = state - 6;
                    var matrix = CubeFaceViewMatrix(Vector3.Zero, faceId);
                    MyEnvProbeProcessing.RunForwardPostprocess(workCubemap.SubresourceRtv(faceId), m_cubemapDepth.SubresourceSrv(faceId), ref matrix);
                    MyEnvProbeProcessing.BuildMipmaps(workCubemap);
                    MyEnvProbeProcessing.Prefilter(workCubemap, workCubemapPrefiltered);

                    ++state;

                    if (state == 12)
                    {
                        blendT0 = MyRender11.CurrentDrawTime;
                    }

                    return;
                }
            }
Esempio n. 9
0
        internal static unsafe void InitSubsystems()
        {
            MyManagers.OnDeviceInit();
            //MyRwTextures.Init();
            MyHwBuffers.Init();
            ResetShadows(MyShadowCascades.Settings.NewData.CascadesCount, RenderSettings.ShadowQuality.ShadowCascadeResolution());
            MyRender11.Init();
            MyCommon.Init();
            MyVertexLayouts.Init();
            MyShaders.Init();
            MyMeshes.Init();
            MyMeshTableSrv.Init();
            MyLightRendering.Init();
            MyLinesRenderer.Init();
            MySpritesRenderer.Init();
            MyPrimitivesRenderer.Init();
            MyOutline.Init();
            MyBlur.Init();
            MyTransparentRendering.Init();

            MyFoliageComponents.Init();

            MyBillboardRenderer.Init(); // hardcoded limits
            MyDebugRenderer.Init();

            MyScreenDecals.Init();
            MyEnvProbeProcessing.Init();
            MyAtmosphereRenderer.Init();
            MyCloudRenderer.Init();
            MyAAEdgeMarking.Init();
            MyScreenPass.Init();
            MyCopyToRT.Init();
            MyBlendTargets.Init();
            MyFXAA.Init();
            MyDepthResolve.Init();
            MyBloom.Init();
            MyLuminanceAverage.Init();
            MyToneMapping.Init();
            MySSAO.Init();
            MyHdrDebugTools.Init();

            MySceneMaterials.Init();
            MyMaterials1.Init();
            MyVoxelMaterials1.Init();
            MyMeshMaterials1.Init();

            MyHBAO.Init();

            try
            {
                if (m_settings.UseStereoRendering)
                {
                    var openVR = new MyOpenVR();
                    MyStereoStencilMask.InitUsingOpenVR();
                }
            }
            catch (System.Exception e)
            {
                if (!VRage.MyCompilationSymbols.DX11ForceStereo)
                {
                    throw;
                }
                MyStereoStencilMask.InitUsingUndefinedMask();
            }
        }
Esempio n. 10
0
        internal void FinalizeEnvProbes()
        {
            if (MyRender11.IsIntelBrokenCubemapsWorkaround)
            {
                return;
            }

            ProfilerShort.Begin("FinalizeEnvProbes");
            MyGpuProfiler.IC_BeginBlock("FinalizeEnvProbes");
            if (m_lastUpdateTime == MyTimeSpan.Zero)
            {
                for (int i = 0; i < 6; i++)
                {
                    PostprocessProbe(i);
                }

                MyGpuProfiler.IC_BeginBlock("BuildMipmaps");
                MyEnvProbeProcessing.BuildMipmaps(m_workCubemap);
                MyGpuProfiler.IC_EndBlock();

                MyGpuProfiler.IC_BeginBlock("Prefilter");
                MyEnvProbeProcessing.Prefilter(m_workCubemap, m_workCubemapPrefiltered);
                MyGpuProfiler.IC_EndBlock();

                MyGpuProfiler.IC_BeginBlock("CopyResource");
                MyImmediateRC.RC.CopyResource(m_workCubemapPrefiltered, m_prevWorkCubemapPrefiltered);
                MyImmediateRC.RC.CopyResource(m_workCubemapPrefiltered, Cubemap);
                MyGpuProfiler.IC_EndBlock();

                m_lastUpdateTime = MyRender11.CurrentDrawTime;
            }
            else
            {
                if (m_state >= 6 && m_state < 12)
                {
                    PostprocessProbe(m_state - 6);
                }
                else if (m_state >= 12)
                {
                    MyGpuProfiler.IC_BeginBlock("BlendAllProbes");
                    BlendAllProbes();
                    MyGpuProfiler.IC_EndBlock();
                }

                if (m_state == 12)
                {
                    MyGpuProfiler.IC_BeginBlock("BuildMipmaps");
                    m_lastUpdateTime = MyRender11.CurrentDrawTime;
                    // whole cubemap is rendered and postprocessed, we can use it
                    MyEnvProbeProcessing.BuildMipmaps(m_workCubemap);
                    MyGpuProfiler.IC_EndBlock();

                    MyGpuProfiler.IC_BeginBlock("Prefilter");
                    MyEnvProbeProcessing.Prefilter(m_workCubemap, m_workCubemapPrefiltered);
                    MyGpuProfiler.IC_EndBlock();
                }

                m_state++;
                MyTimeSpan timeForNextCubemap = m_lastUpdateTime +
                                                MyTimeSpan.FromSeconds(MyEnvironmentProbe.MAX_BLEND_TIME_S);
                if (m_state > 12 && MyRender11.CurrentDrawTime > timeForNextCubemap)
                {
                    m_state = 0; // Time is up, we need to render another environment map
                }
            }
            MyGpuProfiler.IC_EndBlock();
            ProfilerShort.End();
        }