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,
"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": {

View File

@@ -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<MapEntity> lightEnts = new List<MapEntity>();
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++;