Division-by-zero in ComputeSafeOrthonormals on heavy zoom out

Ben Gamari

New Member
Feb 26, 2026
3
2

Game Version

2026.2.38.3713

Operating System

Linux

What Happened​

In map view I inadvertently zoomed out heavily instead of in (the entire solar system was easily in view). This resulted in the following crash:
Code:
18:16:18 ERROR Unhandled exception System.DivideByZeroException: Attempted to divide by zero.
   at KSA.Rendering.Lighting.ShadowUtils.ComputeSafeOrthonormals(float3 inDir, float3& outRight, float3& outUp)
   at KSA.Rendering.Lighting.CascadedShadowSystem.ComputeCascadeViewProj(float4x4& outView, float4x4& outProj, Single& outInvDepthRange, float3& outCascadeSizeWs, Camera inCamera, float3 inLightDir, Int32 shadowMapSize, Single inNear, Single inFar, Boolean stabilize, Single depthPadding, Single overlapTexels)
   at KSA.Rendering.Lighting.CascadedShadowSystem.UpdateUniforms(Camera& inCamera, float3 inSunPos, Int32 inFrameIndex)
   at KSA.Program.UpdateRenderingResources(Int32 frameIndex)
   at KSA.Program.OnFrame(Double currentPlayerTime, Double dtPlayer)
   at KSA.App.Run()
   at KSA.Program.Main(String[] inArgs).
Unhandled exception. System.DivideByZeroException: Attempted to divide by zero.
   at KSA.Rendering.Lighting.ShadowUtils.ComputeSafeOrthonormals(float3 inDir, float3& outRight, float3& outUp)
   at KSA.Rendering.Lighting.CascadedShadowSystem.ComputeCascadeViewProj(float4x4& outView, float4x4& outProj, Single& outInvDepthRange, float3& outCascadeSizeWs, Camera inCamera, float3 inLightDir, Int32 shadowMapSize, Single inNear, Single inFar, Boolean stabilize, Single depthPadding, Single overlapTexels)
   at KSA.Rendering.Lighting.CascadedShadowSystem.UpdateUniforms(Camera& inCamera, float3 inSunPos, Int32 inFrameIndex)
   at KSA.Program.UpdateRenderingResources(Int32 frameIndex)
   at KSA.Program.OnFrame(Double currentPlayerTime, Double dtPlayer)
   at KSA.App.Run()
   at KSA.Program.Main(String[] inArgs)

What Was Expected​

It not crash. :)

Reproduction Steps​

I have struggled to reproduce the crash. My vehicle was in space approaching the SoI of Saturn. Hopefully just auditing the function in question will reveal to culprit division operation.

Reproduction Rate​

once

Additional Info​

  • Video/Screenshots: [Link or attach files]
  • Save File: [Attached/Link to save file if relevant]
  • Other Notes: [Any other relevant details]
 
Upvote 0