Skip to content

Commit 7a89d90

Browse files
committed
Fix the headlight flickering and adjust its intensity
1 parent 1082b9a commit 7a89d90

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Source/RunActivity/Viewer3D/RenderFrame.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public class RenderFrame
390390
static readonly Vector3 MoonGlow = new Vector3(245f / 255f, 243f / 255f, 206f / 255f);
391391
const float SunIntensity = 1;
392392
const float MoonIntensity = SunIntensity / 380000;
393-
float HeadLightIntensity = 50000; // Can be 10 in case of linear calculation method
393+
float HeadLightIntensity = 25000; // See some sample values: https://docs.unity3d.com/Packages/com.unity.cloud.gltfast@5.2/manual/LightUnits.html
394394

395395
// Local shadow map data.
396396
Matrix[] ShadowMapLightView;
@@ -583,6 +583,11 @@ public void PrepareFrame(Viewer viewer)
583583
}
584584
lastLightState = lightState;
585585
}
586+
else
587+
{
588+
fadeStartTimer = 0;
589+
fadeDuration = 0;
590+
}
586591
if (SolarDirection.Y <= -0.05)
587592
{
588593
clampValue = 1; // at nighttime max headlight

0 commit comments

Comments
 (0)