static MyHBAOData()
        {
            Default = new MyHBAOData()
            {
                Enabled = true,

                Radius        = 2.0f,
                Bias          = 0.200000003f,
                SmallScaleAO  = 1.0f,
                LargeScaleAO  = 1.0f,
                PowerExponent = 5.0f,

                BackgroundViewDepth = 0,

                DepthClampToEdge = false,

                DepthThresholdEnable = false,
                ForegroundAOEnable   = true,
                ForegroundViewDepth  = 7.0f,

                BackgroundAOEnable      = false,
                DepthThreshold          = 0,
                DepthThresholdSharpness = 100.0f,

                BlurEnable    = true,
                BlurRadius4   = true,
                BlurSharpness = 1.0f,

                BlurSharpnessFunctionEnable              = false,
                BlurSharpnessFunctionForegroundScale     = 4.0f,
                BlurSharpnessFunctionForegroundViewDepth = 0,
                BlurSharpnessFunctionBackgroundViewDepth = 1.0f,
            };
        }
예제 #2
0
        public static void InitEnvironmentSettings(MyObjectBuilder_EnvironmentSettings environmentBuilder = null)
        {
            if (environmentBuilder != null)
            {
                EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition<MyEnvironmentDefinition>(environmentBuilder.EnvironmentDefinition);
            }
            else if (EnvironmentDefinition == null)
            {
                // Fallback
                EnvironmentDefinition = MyDefinitionManager.Static.GetDefinition<MyEnvironmentDefinition>(MyStringHash.GetOrCompute("Default"));
            }

            var environment = EnvironmentDefinition;
            SunProperties = environment.SunProperties;
            FogProperties = environment.FogProperties;
            SSAOSettings = environment.SSAOSettings;
            HBAOSettings = environment.HBAOSettings;
            ShadowSettings.CopyFrom(environment.ShadowSettings);
            SunRotationAxis = SunProperties.SunRotationAxis;

            MyRenderProxy.UpdateShadowsSettings(ShadowSettings);

            // TODO: Delete MyPostprocessSettingsWrapper and move to have bundled
            // settings in MySector and change all references to point here
            MyPostprocessSettingsWrapper.Settings = environment.PostProcessSettings;
            MyPostprocessSettingsWrapper.PlanetSettings = environment.PostProcessSettings;

            if (environmentBuilder != null)
            {
                Vector3 sunDirection;
                Vector3.CreateFromAzimuthAndElevation(environmentBuilder.SunAzimuth, environmentBuilder.SunElevation, out sunDirection);
                sunDirection.Normalize();

                SunProperties.BaseSunDirectionNormalized = sunDirection;
                SunProperties.SunDirectionNormalized = sunDirection;
                //SunProperties.SunIntensity = environmentBuilder.SunIntensity;

                FogProperties.FogMultiplier = environmentBuilder.FogMultiplier;
                FogProperties.FogDensity = environmentBuilder.FogDensity;
                FogProperties.FogColor = new Color(environmentBuilder.FogColor);
            }
        }
		protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            MyObjectBuilder_EnvironmentDefinition objBuilder = (MyObjectBuilder_EnvironmentDefinition)builder;
            FogProperties = objBuilder.FogProperties;
            SunProperties = objBuilder.SunProperties;
            PostProcessSettings = objBuilder.PostProcessSettings;
            SSAOSettings = objBuilder.SSAOSettings;
            HBAOSettings = objBuilder.HBAOSettings;
            ShadowSettings.CopyFrom(objBuilder.ShadowSettings);
            SmallShipMaxSpeed = objBuilder.SmallShipMaxSpeed;
            LargeShipMaxSpeed = objBuilder.LargeShipMaxSpeed;
            SmallShipMaxAngularSpeed = objBuilder.SmallShipMaxAngularSpeed;
            LargeShipMaxAngularSpeed = objBuilder.LargeShipMaxAngularSpeed;
            ContourHighlightColor = new Color(objBuilder.ContourHighlightColor);
            ContourHighlightThickness = objBuilder.ContourHighlightThickness;
            HighlightPulseInSeconds = objBuilder.HighlightPulseInSeconds;
            EnvironmentTexture = objBuilder.EnvironmentTexture;
            EnvironmentOrientation = objBuilder.EnvironmentOrientation;
        }
        static MyHBAOData()
        {
            Default = new MyHBAOData()
            {
                Enabled = true,

                Radius = 2.0f,
                Bias = 0.200000003f,
                SmallScaleAO = 1.0f,
                LargeScaleAO = 1.0f,
                PowerExponent = 5.0f,

                BackgroundViewDepth = 0,

                DepthClampToEdge = false,

                DepthThresholdEnable = false,
                ForegroundAOEnable = true,
                ForegroundViewDepth = 7.0f,

                BackgroundAOEnable = false,
                DepthThreshold = 0,
                DepthThresholdSharpness = 100.0f,

                BlurEnable = true,
                BlurRadius4 = true,
                BlurSharpness = 1.0f,

                BlurSharpnessFunctionEnable = false,
                BlurSharpnessFunctionForegroundScale = 4.0f,
                BlurSharpnessFunctionForegroundViewDepth = 0,
                BlurSharpnessFunctionBackgroundViewDepth = 1.0f,
            };
        }
예제 #5
0
        internal static void CompilePS()
        {
            if (m_coarseAOPS == PixelShaderId.NULL || m_lastParams.BackgroundAOEnable != Params.BackgroundAOEnable ||
                m_lastParams.ForegroundAOEnable != Params.ForegroundAOEnable ||
                m_lastParams.DepthThresholdEnable != Params.DepthThresholdEnable)
            {
                m_macros.Clear();
                m_macros.Add(new SharpDX.Direct3D.ShaderMacro("FETCH_GBUFFER_NORMAL", 1));
                if (Params.BackgroundAOEnable)
                    m_macros.Add(new SharpDX.Direct3D.ShaderMacro("ENABLE_BACKGROUND_AO", 1));
                if (Params.ForegroundAOEnable)
                    m_macros.Add(new SharpDX.Direct3D.ShaderMacro("ENABLE_FOREGROUND_AO", 1));
                if (Params.DepthThresholdEnable)
                    m_macros.Add(new SharpDX.Direct3D.ShaderMacro("ENABLE_DEPTH_THRESHOLD", 1));
                m_coarseAOPS = MyShaders.CreatePs("Postprocess/HBAO/CoarseAO.hlsl", m_macros.ToArray());
            }

            if (m_blurXPS == PixelShaderId.NULL || m_blurYPS == PixelShaderId.NULL ||
                m_lastParams.BlurSharpnessFunctionEnable != Params.BlurSharpnessFunctionEnable ||
                m_lastParams.BlurRadius4 != Params.BlurRadius4)
            {
                m_macros.Clear();
                if (Params.BlurSharpnessFunctionEnable)
                    m_macros.Add(new SharpDX.Direct3D.ShaderMacro("ENABLE_SHARPNESS_PROFILE", 1));
                if (Params.BlurRadius4)
                    m_macros.Add(new SharpDX.Direct3D.ShaderMacro("KERNEL_RADIUS", 4));
                else m_macros.Add(new SharpDX.Direct3D.ShaderMacro("KERNEL_RADIUS", 2));
                m_blurXPS = MyShaders.CreatePs("Postprocess/HBAO/BlurX.hlsl", m_macros.ToArray());
                m_blurYPS = MyShaders.CreatePs("Postprocess/HBAO/BlurY.hlsl", m_macros.ToArray());
            }
            m_lastParams = Params;
        }
예제 #6
0
 static MyHBAO()
 {
     Params = MyHBAOData.Default;
 }
예제 #7
0
        public static void UpdateHBAOSettings(MyHBAOData data)
        {
            var message = MessagePool.Get<MyRenderMessageUpdateHBAO>(MyRenderMessageEnum.UpdateHBAO);

            message.Data = data;

            EnqueueMessage(message);
        }
예제 #8
0
        public static void UpdateHBAOSettings(ref MyHBAOData settings)
        {
            var message = MessagePool.Get<MyRenderMessageUpdateHBAO>(MyRenderMessageEnum.UpdateHBAO);

            message.Settings = settings;

            EnqueueMessage(message);
        }