Beispiel #1
0
 private void CheckArrays(MyRenderSettings settings)
 {
     CheckArrays();
     Array.Resize(ref ShadowCascadeFrozen, settings.ShadowCascadeFrozen.Length);
     if (ShadowCascadeSmallSkipThresholds == null || (settings.ShadowCascadeSmallSkipThresholds != null && ShadowCascadeSmallSkipThresholds.Length < settings.ShadowCascadeSmallSkipThresholds.Length))
     {
         ShadowCascadeSmallSkipThresholds = new float[settings.ShadowCascadeSmallSkipThresholds.Length];
     }
 }
Beispiel #2
0
        public void BeforeRender(MyRenderSettings writeTo, MyTimeSpan?currentDrawTime)
        {
            using (m_lock.Acquire())
            {
                if (currentDrawTime.HasValue)
                {
                    MyRenderProxy.CurrentDrawTime = currentDrawTime.Value;
                }

                writeTo.Synchronize(m_inputRenderSettings);
            }
        }
Beispiel #3
0
        internal static void UpdateRenderSettings(MyRenderSettings settings)
        {
            Log.WriteLine("UpdateRenderSettings");
            Log.IncreaseIndent();

            var prevSettings = Settings;

            Settings = settings;

            LogUpdateRenderSettings();

            if (settings.User.GrassDensityFactor != prevSettings.User.GrassDensityFactor)
            {
                DisposeGrass();
            }

            MyRenderConstants.SwitchRenderQuality(settings.User.Dx9Quality); //because of lod ranges

            if (settings.User.ShadowQuality != prevSettings.User.ShadowQuality)
            {
                ResetShadows(MyShadowCascades.Settings.NewData.CascadesCount, settings.User.ShadowQuality.ShadowCascadeResolution());
            }

            if (settings.User.AntialiasingMode != prevSettings.User.AntialiasingMode)
            {
                UpdateAntialiasingMode(settings.User.AntialiasingMode, prevSettings.User.AntialiasingMode);
            }

            if (settings.User.AnisotropicFiltering != prevSettings.User.AnisotropicFiltering)
            {
                MySamplerStateManager.UpdateFiltering();
            }

            if (settings.User.TextureQuality != prevSettings.User.TextureQuality)
            {
                MyVoxelMaterials1.InvalidateMaterials();
                MyMeshMaterials1.InvalidateMaterials();
                MyManagers.FileTextures.DisposeTex(MyFileTextureManager.MyFileTextureHelper.IsQualityDependantFilter);
                MyManagers.DynamicFileArrayTextures.ReloadAll();

                //MyVoxelMaterials.ReloadTextures();
                //MyMaterialProxyFactory.ReloadTextures();
            }

            m_settingsChangedListeners();

            Log.DecreaseIndent();
        }
Beispiel #4
0
        public void AfterUpdate(MyRenderSettings inputSettings, MyTimeSpan?updateTimestamp)
        {
            using (m_lock.Acquire())
            {
                if (updateTimestamp.HasValue)
                {
                    m_inputRenderMessages.CurrentUpdateFrame.UpdateTimestamp = updateTimestamp.Value;
                }

                m_inputRenderMessages.CommitUpdateFrame();
                m_inputRenderSettings.Synchronize(inputSettings); // TODO: OP! Better settings synchronization
                m_inputBillboards.CommitWrite();
                m_inputBillboards.Write.Clear();
                m_inputTriangleBillboards.CommitWrite();
                m_inputTriangleBillboards.Write.Clear();
            }
        }
Beispiel #5
0
        internal void Synchronize(MyRenderSettings settings)
        {
            CheckArrays(settings);

            EnableHWOcclusionQueries = settings.EnableHWOcclusionQueries;

            SkipLOD_NEAR = settings.SkipLOD_NEAR;
            SkipLOD_0    = settings.SkipLOD_0;
            SkipLOD_1    = settings.SkipLOD_1;

            SkipVoxels   = settings.SkipVoxels;
            VoxelQuality = settings.VoxelQuality;

            //Debug properties
            ShowEnvironmentScreens = settings.ShowEnvironmentScreens;
            ShowBlendedScreens     = settings.ShowBlendedScreens;
            ShowGreenBackground    = settings.ShowGreenBackground;
            ShowLod1WithRedOverlay = settings.ShowLod1WithRedOverlay;

            EnableLightsRuntime            = settings.EnableLightsRuntime;
            ShowEnhancedRenderStatsEnabled = settings.ShowEnhancedRenderStatsEnabled;
            ShowResourcesStatsEnabled      = settings.ShowResourcesStatsEnabled;
            ShowTexturesStatsEnabled       = settings.ShowTexturesStatsEnabled;

            EnableSun             = settings.EnableSun;
            EnableShadows         = settings.EnableShadows;
            EnableAsteroidShadows = settings.EnableAsteroidShadows;
            EnableFog             = settings.EnableFog;

            DebugRenderClipmapCells = settings.DebugRenderClipmapCells;

            EnableVoxelMerging     = settings.EnableVoxelMerging;
            DebugRenderMergedCells = settings.DebugRenderMergedCells;

            EnableEnvironmentMapAmbient    = settings.EnableEnvironmentMapAmbient;
            EnableEnvironmentMapReflection = settings.EnableEnvironmentMapReflection;

            ShadowCascadeCount       = settings.ShadowCascadeCount;
            ShowShadowCascadeSplits  = settings.ShowShadowCascadeSplits;
            EnableShadowBlur         = settings.EnableShadowBlur;
            ShadowInterleaving       = settings.ShadowInterleaving;
            UpdateCascadesEveryFrame = settings.UpdateCascadesEveryFrame;
            ShadowCascadeMaxDistanceMultiplierMedium = settings.ShadowCascadeMaxDistanceMultiplierMedium;
            ShadowCascadeMaxDistanceMultiplierHigh   = settings.ShadowCascadeMaxDistanceMultiplierHigh;
            ShadowCascadeZOffset      = settings.ShadowCascadeZOffset;
            ShadowCascadeSpreadFactor = settings.ShadowCascadeSpreadFactor;
            ShadowFadeoutMultiplier   = settings.ShadowFadeoutMultiplier;
            ShadowCascadeMaxDistance  = settings.ShadowCascadeMaxDistance;

            //for (int index = 0; index < settings.ShadowCascadeCount; ++index)
            //{
            //	ShadowCascadeFrozen[index] = settings.ShadowCascadeFrozen[index];
            //	ShadowCascadeSmallSkipThresholds[index] = settings.ShadowCascadeSmallSkipThresholds[index];
            //}

            Wireframe = settings.Wireframe;
            EnableStencilOptimization     = settings.EnableStencilOptimization;
            EnableStencilOptimizationLOD1 = settings.EnableStencilOptimizationLOD1;
            ShowStencilOptimization       = settings.ShowStencilOptimization;

            CheckDiffuseTextures = settings.CheckDiffuseTextures;
            CheckNormalTextures  = settings.CheckNormalTextures;

            ShowSpecularIntensity = settings.ShowSpecularIntensity;
            ShowSpecularPower     = settings.ShowSpecularPower;
            ShowEmissivity        = settings.ShowEmissivity;
            ShowReflectivity      = settings.ShowReflectivity;

            EnableSpotShadows = settings.EnableSpotShadows;

            VisualizeOverdraw = settings.VisualizeOverdraw;
            MultimonTest      = settings.MultimonTest;

            EnableCameraInterpolation = settings.EnableCameraInterpolation;
            EnableObjectInterpolation = settings.EnableObjectInterpolation;
            InterpolationLagMs        = settings.InterpolationLagMs;
            LagFeedbackMult           = settings.LagFeedbackMult;

            DisplayGbufferColor       = settings.DisplayGbufferColor;
            DisplayGbufferColorLinear = settings.DisplayGbufferColorLinear;
            DisplayGbufferNormal      = settings.DisplayGbufferNormal;
            DisplayGbufferGlossiness  = settings.DisplayGbufferGlossiness;
            DisplayGbufferMetalness   = settings.DisplayGbufferMetalness;
            DisplayGbufferMaterialID  = settings.DisplayGbufferMaterialID;
            DisplayGbufferAO          = settings.DisplayGbufferAO;
            DisplayEmissive           = settings.DisplayEmissive;
            DisplayEdgeMask           = settings.DisplayEdgeMask;
            DisplayDepth   = settings.DisplayDepth;
            DisplayStencil = settings.DisplayStencil;

            RgbMultiplier       = settings.RgbMultiplier;
            MetalnessMultiplier = settings.MetalnessMultiplier;
            GlossMultiplier     = settings.GlossMultiplier;
            AoMultiplier        = settings.AoMultiplier;
            EmissiveMultiplier  = settings.EmissiveMultiplier;
            ColorMaskMultiplier = settings.ColorMaskMultiplier;

            DisplayAmbientDiffuse  = settings.DisplayAmbientDiffuse;
            DisplayAmbientSpecular = settings.DisplayAmbientSpecular;

            DrawParticleRenderTarget = settings.DrawParticleRenderTarget;

            DisplayIDs            = settings.DisplayIDs;
            DisplayAabbs          = settings.DisplayAabbs;
            DrawMergeInstanced    = settings.DrawMergeInstanced;
            DrawNonMergeInstanced = settings.DrawNonMergeInstanced;

            TerrainDetailD0      = settings.TerrainDetailD0;
            TerrainDetailD1      = settings.TerrainDetailD1;
            TerrainDetailD2      = settings.TerrainDetailD2;
            TerrainDetailD3      = settings.TerrainDetailD3;
            FreezeTerrainQueries = settings.FreezeTerrainQueries;

            GrassPostprocess = settings.GrassPostprocess;
            GrassPostprocessCloseDistance      = settings.GrassPostprocessCloseDistance;
            GrassGeometryClippingDistance      = settings.GrassGeometryClippingDistance;
            GrassGeometryScalingNearDistance   = settings.GrassGeometryScalingNearDistance;
            GrassGeometryScalingFarDistance    = settings.GrassGeometryScalingFarDistance;
            GrassGeometryDistanceScalingFactor = settings.GrassGeometryDistanceScalingFactor;
            GrassDensityFactor = settings.GrassDensityFactor;

            WindStrength = settings.WindStrength;
            WindAzimuth  = settings.WindAzimuth;

            DisplayShadowsWithDebug = settings.DisplayShadowsWithDebug;
            DrawCascadeTextures     = settings.DrawCascadeTextures;
            DisplayNDotL            = settings.DisplayNDotL;

            EnableParallelRendering = settings.EnableParallelRendering;
            ForceImmediateContext   = settings.ForceImmediateContext;
            RenderBatchSize         = settings.RenderBatchSize;
            AmortizeBatchWork       = settings.AmortizeBatchWork;
            LoopObjectThenPass      = settings.LoopObjectThenPass;
            RenderThreadAsWorker    = settings.RenderThreadAsWorker;

            //EnableTonemapping = settings.EnableTonemapping;
            DisplayHdrDebug          = settings.DisplayHdrDebug;
            AdaptationTau            = settings.AdaptationTau;
            LuminanceExposure        = settings.LuminanceExposure;
            Contrast                 = settings.Contrast;
            Brightness               = settings.Brightness;
            MiddleGrey               = settings.MiddleGrey;
            BloomExposure            = settings.BloomExposure;
            BloomMult                = settings.BloomMult;
            MiddleGreyCurveSharpness = settings.MiddleGreyCurveSharpness;
            MiddleGreyAt0            = settings.MiddleGreyAt0;
            BlueShiftRapidness       = settings.BlueShiftRapidness;
            BlueShiftScale           = settings.BlueShiftScale;

            BacklightMult = settings.BacklightMult;
            EnvMult       = settings.EnvMult;

            FogDensity = settings.FogDensity;
            FogMult    = settings.FogMult;
            FogYOffset = settings.FogYOffset;
            FogColor   = settings.FogColor;

            FoliageLod0Distance = settings.FoliageLod0Distance;
            FoliageLod1Distance = settings.FoliageLod1Distance;
            FoliageLod2Distance = settings.FoliageLod2Distance;
            FoliageLod3Distance = settings.FoliageLod3Distance;
            EnableFoliageDebug  = settings.EnableFoliageDebug;
            FreezeFoliageViewer = settings.FreezeFoliageViewer;
        }
Beispiel #6
0
        internal void Synchronize(MyRenderSettings settings)
        {
            EnableHWOcclusionQueries = settings.EnableHWOcclusionQueries;

            SkipLOD_NEAR = settings.SkipLOD_NEAR;
            SkipLOD_0    = settings.SkipLOD_0;
            SkipLOD_1    = settings.SkipLOD_1;

            SkipVoxels = settings.SkipVoxels;

            //Debug properties
            ShowEnvironmentScreens = settings.ShowEnvironmentScreens;
            ShowBlendedScreens     = settings.ShowBlendedScreens;
            ShowGreenBackground    = settings.ShowGreenBackground;
            ShowLod1WithRedOverlay = settings.ShowLod1WithRedOverlay;

            EnableLightsRuntime            = settings.EnableLightsRuntime;
            ShowEnhancedRenderStatsEnabled = settings.ShowEnhancedRenderStatsEnabled;
            ShowResourcesStatsEnabled      = settings.ShowResourcesStatsEnabled;
            ShowTexturesStatsEnabled       = settings.ShowTexturesStatsEnabled;

            EnableSun             = settings.EnableSun;
            EnableShadows         = settings.EnableShadows;
            EnableAsteroidShadows = settings.EnableAsteroidShadows;
            EnableFog             = settings.EnableFog;

            DebugRenderClipmapCells = settings.DebugRenderClipmapCells;

            EnableEnvironmentMapAmbient    = settings.EnableEnvironmentMapAmbient;
            EnableEnvironmentMapReflection = settings.EnableEnvironmentMapReflection;
            EnablePerVertexVoxelAmbient    = settings.EnablePerVertexVoxelAmbient;
            ShowCascadeSplits = settings.ShowCascadeSplits;

            //blinkg moving asteroids
            ShadowInterleaving = settings.ShadowInterleaving;

            FreezeCascade[0] = settings.FreezeCascade[0];
            FreezeCascade[1] = settings.FreezeCascade[1];
            FreezeCascade[2] = settings.FreezeCascade[2];
            FreezeCascade[3] = settings.FreezeCascade[3];

            Wireframe = settings.Wireframe;
            EnableStencilOptimization     = settings.EnableStencilOptimization;
            EnableStencilOptimizationLOD1 = settings.EnableStencilOptimizationLOD1;
            ShowStencilOptimization       = settings.ShowStencilOptimization;

            CheckDiffuseTextures = settings.CheckDiffuseTextures;
            CheckNormalTextures  = settings.CheckNormalTextures;

            ShowSpecularIntensity = settings.ShowSpecularIntensity;
            ShowSpecularPower     = settings.ShowSpecularPower;
            ShowEmissivity        = settings.ShowEmissivity;
            ShowReflectivity      = settings.ShowReflectivity;

            EnableSpotShadows = settings.EnableSpotShadows;

            VisualizeOverdraw = settings.VisualizeOverdraw;
            MultimonTest      = settings.MultimonTest;

            EnableCameraInterpolation = settings.EnableCameraInterpolation;
            EnableObjectInterpolation = settings.EnableObjectInterpolation;
            InterpolationLagMs        = settings.InterpolationLagMs;
            LagFeedbackMult           = settings.LagFeedbackMult;

            DisplayGbufferColor       = settings.DisplayGbufferColor;
            DisplayGbufferColorLinear = settings.DisplayGbufferColorLinear;
            DisplayGbufferNormal      = settings.DisplayGbufferNormal;
            DisplayGbufferGlossiness  = settings.DisplayGbufferGlossiness;
            DisplayGbufferMetalness   = settings.DisplayGbufferMetalness;
            DisplayGbufferMaterialID  = settings.DisplayGbufferMaterialID;
            DisplayAO       = settings.DisplayAO;
            DisplayEmissive = settings.DisplayEmissive;
            DisplayEdgeMask = settings.DisplayEdgeMask;

            DisplayAmbientDiffuse  = settings.DisplayAmbientDiffuse;
            DisplayAmbientSpecular = settings.DisplayAmbientSpecular;
            NightMode            = settings.NightMode;
            DisplayIDs           = settings.DisplayIDs;
            DisplayAabbs         = settings.DisplayAabbs;
            DrawOnlyMergedMeshes = settings.DrawOnlyMergedMeshes;

            TerrainDetailD0      = settings.TerrainDetailD0;
            TerrainDetailD1      = settings.TerrainDetailD1;
            TerrainDetailD2      = settings.TerrainDetailD2;
            TerrainDetailD3      = settings.TerrainDetailD3;
            FreezeTerrainQueries = settings.FreezeTerrainQueries;

            GrassPostprocess = settings.GrassPostprocess;
            GrassPostprocessCloseDistance      = settings.GrassPostprocessCloseDistance;
            GrassGeometryClippingDistance      = settings.GrassGeometryClippingDistance;
            GrassGeometryScalingNearDistance   = settings.GrassGeometryScalingNearDistance;
            GrassGeometryScalingFarDistance    = settings.GrassGeometryScalingFarDistance;
            GrassGeometryDistanceScalingFactor = settings.GrassGeometryDistanceScalingFactor;

            WindStrength = settings.WindStrength;
            WindAzimuth  = settings.WindAzimuth;

            DisplayShadowsWithDebug = settings.DisplayShadowsWithDebug;

            UpdateCascadesEveryFrame = settings.UpdateCascadesEveryFrame;
            CascadesSplit0           = settings.CascadesSplit0;
            CascadesSplit1           = settings.CascadesSplit1;
            CascadesSplit2           = settings.CascadesSplit2;
            CascadesSplit3           = settings.CascadesSplit3;

            EnableParallelRendering = settings.EnableParallelRendering;
            ForceImmediateContext   = settings.ForceImmediateContext;
            RenderBatchSize         = settings.RenderBatchSize;
            AmortizeBatchWork       = settings.AmortizeBatchWork;
            LoopObjectThenPass      = settings.LoopObjectThenPass;
            RenderThreadAsWorker    = settings.RenderThreadAsWorker;

            Cascade0SmallSkip = settings.Cascade0SmallSkip;
            Cascade1SmallSkip = settings.Cascade1SmallSkip;
            Cascade2SmallSkip = settings.Cascade2SmallSkip;
            Cascade3SmallSkip = settings.Cascade3SmallSkip;

            EnableTonemapping        = settings.EnableTonemapping;
            DispalyHdrDebug          = settings.DispalyHdrDebug;
            AdaptationTau            = settings.AdaptationTau;
            LuminanceExposure        = settings.LuminanceExposure;
            Contrast                 = settings.Contrast;
            Brightness               = settings.Brightness;
            MiddleGrey               = settings.MiddleGrey;
            BloomExposure            = settings.BloomExposure;
            BloomMult                = settings.BloomMult;
            MiddleGreyCurveSharpness = settings.MiddleGreyCurveSharpness;
            MiddleGreyAt0            = settings.MiddleGreyAt0;
            BlueShiftRapidness       = settings.BlueShiftRapidness;
            BlueShiftScale           = settings.BlueShiftScale;

            BacklightMult = settings.BacklightMult;
            EnvMult       = settings.EnvMult;

            FogDensity = settings.FogDensity;
            FogMult    = settings.FogMult;
            FogYOffset = settings.FogYOffset;
            FogColor   = settings.FogColor;

            FoliageLod0Distance = settings.FoliageLod0Distance;
            FoliageLod1Distance = settings.FoliageLod1Distance;
            FoliageLod2Distance = settings.FoliageLod2Distance;
            FoliageLod3Distance = settings.FoliageLod3Distance;
            EnableFoliageDebug  = settings.EnableFoliageDebug;
            FreezeFoliageViewer = settings.FreezeFoliageViewer;
        }
        static MyRenderSettings()
        {
            Default = new MyRenderSettings()
            {
                UseGeometryArrayTextures = false,

                EnableHWOcclusionQueries = true,
                SkipLOD_NEAR             = false,
                SkipLOD_0                      = false,
                SkipLOD_1                      = false,
                SkipVoxels                     = false,
                TearingTest                    = false,
                MultimonTest                   = false,
                ShowEnvironmentScreens         = false,
                ShowBlendedScreens             = false,
                ShowGreenBackground            = false,
                ShowLod1WithRedOverlay         = false,
                EnableLightsRuntime            = true,
                EnableSpotLights               = true,
                EnablePointLights              = true,
                EnableLightGlares              = true,
                ShowEnhancedRenderStatsEnabled = false,
                ShowResourcesStatsEnabled      = false,
                ShowTexturesStatsEnabled       = false,
                EnableSun                      = true,
                EnableShadows                  = true,
                EnableAsteroidShadows          = false,
                EnableFog                      = true,
                DebugRenderMergedCells         = false,
                DebugRenderClipmapCells        = false,
                DebugClipmapLodColor           = false,
                SkipLodUpdates                 = false,
                VoxelQuality                   = MyRenderQualityEnum.NORMAL,
                EnableVoxelMerging             = false,
                Wireframe                      = false,
                EnableStencilOptimization      = true,
                EnableStencilOptimizationLOD1  = true,
                ShowStencilOptimization        = false,
                CheckDiffuseTextures           = true,
                CheckNormalTextures            = false,
                ShowSpecularIntensity          = false,
                ShowSpecularPower              = false,
                ShowEmissivity                 = false,
                ShowReflectivity               = false,
                EnableSpotShadows              = true,
                VisualizeOverdraw              = false,
                InterpolationLagMs             = 22,
                LagFeedbackMult                = 0.25f,
                EnableCameraInterpolation      = false,
                EnableObjectInterpolation      = false,
                DisplayGbufferColor            = false,
                DisplayGbufferAlbedo           = false,
                DisplayGbufferNormal           = false,
                DisplayGbufferNormalView       = false,
                DisplayGbufferGlossiness       = false,
                DisplayGbufferMetalness        = false,
                DisplayGbufferLOD              = false,
                DisplayGbufferAO               = false,
                DisplayEmissive                = false,
                DisplayEdgeMask                = false,
                DisplayNDotL                   = false,
                DisplayDepth                   = false,
                DisplayStencil                 = false,
                DisplayEnvProbe                = false,
                DisplayBloomFilter             = false,
                DisplayBloomMin                = false,
                DisplayAO                      = false,
                AlbedoMultiplier               = 1.0f,
                MetalnessMultiplier            = 1.0f,
                GlossMultiplier                = 1.0f,
                AoMultiplier                   = 1.0f,
                EmissiveMultiplier             = 1.0f,
                ColorMaskMultiplier            = 1.0f,
                AlbedoShift                    = 0.0f,
                MetalnessShift                 = 0.0f,
                GlossShift                     = 0.0f,
                AoShift                                = 0.0f,
                EmissiveShift                          = 0.0f,
                ColorMaskShift                         = 0.0f,
                DisplayAmbientDiffuse                  = false,
                DisplayAmbientSpecular                 = false,
                DisplayIDs                             = false,
                DisplayAabbs                           = false,
                DrawMergeInstanced                     = true,
                DrawNonMergeInstanced                  = true,
                TerrainDetailD0                        = 5,
                TerrainDetailD1                        = 40,
                TerrainDetailD2                        = 125.0f,
                TerrainDetailD3                        = 200,
                FreezeTerrainQueries                   = false,
                GrassPostprocess                       = true,
                GrassPostprocessCloseDistance          = 25f,
                GrassGeometryClippingDistance          = 500f,
                GrassGeometryScalingNearDistance       = 50f,
                GrassGeometryScalingFarDistance        = 350f,
                GrassGeometryDistanceScalingFactor     = 5f,
                GrassMaxDrawDistance                   = 250,
                GrassDensityFactor                     = 1.0f,
                DisplayShadowsWithDebug                = false,
                DrawCascadeTextures                    = false,
                RwTexturePool_FramesToPreserveTextures = 16,
                UseDebugMissingFileTextures            = false,
                EnvMapDepth                            = 100.0f,
                EnableParallelRendering                = true,
                ForceImmediateContext                  = false,
                AmortizeBatchWork                      = true,
                RenderBatchSize                        = 100,
                RenderThreadAsWorker                   = true,
                DisplayHistogram                       = false,
                FogDensity                             = 0.003f,
                FogMult                                = 0.295f,
                FogColor                               = new VRageMath.Vector4(60 / 255f, 119 / 255f, 255 / 255f, 0),
                WindStrength                           = 0.3f,
                WindAzimuth                            = 0,
                FoliageLod0Distance                    = 25,
                FoliageLod1Distance                    = 50,
                FoliageLod2Distance                    = 100,
                FoliageLod3Distance                    = 100,
                EnableFoliageDebug                     = false,
                FreezeFoliageViewer                    = false,
                DebugDrawDecals                        = false,
                PerInstanceLods                        = true,
                OffscreenSpritesRendering              = false,
            };
        }