From ae02b772e0d42ef56824370ec5ff0feef00f8700 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Sun, 19 Jun 2022 14:26:40 +0300 Subject: [PATCH] level indirect light variable --- .../EngineSettings/GraphicsSettings.json | 13 +++++----- Source/Game/Level/Q3MapImporter.cs | 24 +++++++++++++++---- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Content/Settings/EngineSettings/GraphicsSettings.json b/Content/Settings/EngineSettings/GraphicsSettings.json index b9a39b6..4fe9a14 100644 --- a/Content/Settings/EngineSettings/GraphicsSettings.json +++ b/Content/Settings/EngineSettings/GraphicsSettings.json @@ -11,6 +11,7 @@ "ShadowsQuality": 3, "ShadowMapsQuality": 3, "AllowCSMBlending": true, + "EnableGlobalSDF": true, "GlobalSDFQuality": 2, "GenerateSDFOnModelImport": true, "GIQuality": 2, @@ -26,16 +27,16 @@ "FadeDistance": 500.0 }, "GI": { - "OverrideFlags": 0, - "Mode": 0, + "OverrideFlags": 27, + "Mode": 1, "Intensity": 1.0, "TemporalResponse": 0.9, - "Distance": 20000.0, + "Distance": 7000.0, "FallbackIrradiance": { - "R": 0.0, + "R": 1.0, "G": 0.0, - "B": 0.0, - "A": 0.0 + "B": 0.836574554, + "A": 1.0 } }, "Bloom": { diff --git a/Source/Game/Level/Q3MapImporter.cs b/Source/Game/Level/Q3MapImporter.cs index c71e4bf..fc381e6 100644 --- a/Source/Game/Level/Q3MapImporter.cs +++ b/Source/Game/Level/Q3MapImporter.cs @@ -56,6 +56,7 @@ namespace Game private float lightRadiusMultiplier_ = 9.45f; private float fallOffExponent_ = 2.0f; private float saturationMultiplier_ = 1.0f; + private float indirectLightMultiplier_ = 1.0f; private List lightEnts = new List(); private Actor worldSpawnActor = null; @@ -87,6 +88,13 @@ namespace Game set { saturationMultiplier_ = value; resetLights = true; } } + [Range(1f, 100f)] + public float IndirectLightMultiplier + { + get => indirectLightMultiplier_; + set { indirectLightMultiplier_ = value; resetLights = true; } + } + private static void QuickHull(Float3[] points, out Float3[] outVertices) { @@ -1030,16 +1038,21 @@ namespace Game var task = Task.Run(() => { Stopwatch sw = Stopwatch.StartNew(); - Console.Print($"Generating level SDF ({sdfModels.Count} models)..."); + FlaxEngine.Debug.Log($"Generating level SDF ({sdfModels.Count} models)..."); - Parallel.ForEach(sdfModels/*, new ParallelOptions() { MaxDegreeOfParallelism = 1 }*/, model => + ParallelOptions opts = new ParallelOptions(); + FlaxEngine.Debug.Log("processorcount: " + Environment.ProcessorCount); + if (useStaticBatching) + opts.MaxDegreeOfParallelism = 2;//Environment.ProcessorCount / 2; + Parallel.ForEach(sdfModels, opts, model => { if (model.WaitForLoaded()) throw new Exception("model was not loaded"); - model.GenerateSDF(); + + model.GenerateSDF(0.9f, 6, true, 0.15f); }); - Console.Print($"Generated level SDF in {sw.Elapsed.TotalMilliseconds}ms"); + FlaxEngine.Debug.Log($"Generated level SDF in {sw.Elapsed.TotalMilliseconds}ms"); }); } } @@ -1113,9 +1126,12 @@ namespace Game hsv.Y *= SaturationMultiplier; light.Color = Color.FromHSV(hsv); + light.IndirectLightingIntensity = IndirectLightMultiplier; + light.ShadowsDepthBias = 0.0565f; // if low quality shadows light.ShadowsDepthBias = 0.2492f; + } lightIndex++;