level indirect light variable

This commit is contained in:
2022-06-19 14:26:40 +03:00
parent 929c5de6ed
commit ae02b772e0
2 changed files with 27 additions and 10 deletions

View File

@@ -11,6 +11,7 @@
"ShadowsQuality": 3, "ShadowsQuality": 3,
"ShadowMapsQuality": 3, "ShadowMapsQuality": 3,
"AllowCSMBlending": true, "AllowCSMBlending": true,
"EnableGlobalSDF": true,
"GlobalSDFQuality": 2, "GlobalSDFQuality": 2,
"GenerateSDFOnModelImport": true, "GenerateSDFOnModelImport": true,
"GIQuality": 2, "GIQuality": 2,
@@ -26,16 +27,16 @@
"FadeDistance": 500.0 "FadeDistance": 500.0
}, },
"GI": { "GI": {
"OverrideFlags": 0, "OverrideFlags": 27,
"Mode": 0, "Mode": 1,
"Intensity": 1.0, "Intensity": 1.0,
"TemporalResponse": 0.9, "TemporalResponse": 0.9,
"Distance": 20000.0, "Distance": 7000.0,
"FallbackIrradiance": { "FallbackIrradiance": {
"R": 0.0, "R": 1.0,
"G": 0.0, "G": 0.0,
"B": 0.0, "B": 0.836574554,
"A": 0.0 "A": 1.0
} }
}, },
"Bloom": { "Bloom": {

View File

@@ -56,6 +56,7 @@ namespace Game
private float lightRadiusMultiplier_ = 9.45f; private float lightRadiusMultiplier_ = 9.45f;
private float fallOffExponent_ = 2.0f; private float fallOffExponent_ = 2.0f;
private float saturationMultiplier_ = 1.0f; private float saturationMultiplier_ = 1.0f;
private float indirectLightMultiplier_ = 1.0f;
private List<MapEntity> lightEnts = new List<MapEntity>(); private List<MapEntity> lightEnts = new List<MapEntity>();
private Actor worldSpawnActor = null; private Actor worldSpawnActor = null;
@@ -87,6 +88,13 @@ namespace Game
set { saturationMultiplier_ = value; resetLights = true; } 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) private static void QuickHull(Float3[] points, out Float3[] outVertices)
{ {
@@ -1030,16 +1038,21 @@ namespace Game
var task = Task.Run(() => var task = Task.Run(() =>
{ {
Stopwatch sw = Stopwatch.StartNew(); 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()) if (model.WaitForLoaded())
throw new Exception("model was not loaded"); 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; hsv.Y *= SaturationMultiplier;
light.Color = Color.FromHSV(hsv); light.Color = Color.FromHSV(hsv);
light.IndirectLightingIntensity = IndirectLightMultiplier;
light.ShadowsDepthBias = 0.0565f; light.ShadowsDepthBias = 0.0565f;
// if low quality shadows // if low quality shadows
light.ShadowsDepthBias = 0.2492f; light.ShadowsDepthBias = 0.2492f;
} }
lightIndex++; lightIndex++;