Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when switching to a vessel on a distant world (rouqea from kcalbeloh) #223

Open
JonnyOThan opened this issue Nov 1, 2024 · 9 comments

Comments

@JonnyOThan
Copy link
Contributor

Crash_2024-11-01_152042969.zip

We can reproduce this consistently in TPKSP. I think it started happening with the latest parallax continued update but I'm not 100% sure. I'm sending this here just because it's got scatterer in the callstack but the reflection probe is probably from deferred too.

Searching for "cullCastersCommon" turns up some stuff about possibly bad camera transforms, which seems plausible if the floating origin is in a bad state.

https://discussions.unity.com/t/get-crash-in-cullcasterscommon-randomly/736298

https://issuetracker.unity3d.com/issues/crash-on-cullcasterscommon-when-assigning-an-infinite-value-in-transform-dot-translate-on-a-camera-which-renders-shadows

@LGhassen
Copy link
Owner

LGhassen commented Nov 1, 2024

I don't know where to even start with this. Scatterer adds the rendering of the scaled camera and the galaxy camera to the reflectionProbe which is where this issue seems to happen, only both of those don't have shadows to my knowledge (I don't think Parallax-continued enables shadows on those cameras either). Maybe a quick solution would be to disable this script, or disable shadows, or disable reflection probe rendering when switching vessels.

@JonnyOThan
Copy link
Contributor Author

JonnyOThan commented Nov 1, 2024

Ooh I think if I hook up the debugger and reproduce the issue I'll be able to get way more data about the camera involved. I'm working through an atmofx crash that is similar, but the main thread callstack is different. Could end up being the same thing but at least I'm confident I can get more data about this one.

@JonnyOThan
Copy link
Contributor Author

Is it possible to disable shadows on a specific camera? Or do you have to use a replacement shader?

@LGhassen
Copy link
Owner

LGhassen commented Nov 1, 2024

You're right I thought there was a way in the API but it doesn't seem to be there. Maybe just disabling shadows globally via https://docs.unity3d.com/2019.4/Documentation/ScriptReference/QualitySettings-shadows.html then restoring the value after the switch.

@LGhassen
Copy link
Owner

LGhassen commented Nov 1, 2024

If you can also identify the offending camera that might be helpful

@JonnyOThan
Copy link
Contributor Author

yeah, confirmed that the camera transforms are bad:
image

Camera name: ScattererReflectionProbeScaledSpaceCamera
image

interesting:

<title>Document</title>
  Name Value Type
m_WorldToCameraMatrix {m_Data=0x00000217ee26e79c {0.00000000, 0.00000000, -1.00000000, 0.00000000, 0.00000000, -1.00000000, ...} } Matrix4x4f
  ◢ m_Data 0x00000217ee26e79c {0.00000000, 0.00000000, -1.00000000, 0.00000000, 0.00000000, -1.00000000, 0.00000000, ...} float[0x00000010]
  [0x00000000] 0.00000000 float
  [0x00000001] 0.00000000 float
  [0x00000002] -1.00000000 float
  [0x00000003] 0.00000000 float
  [0x00000004] 0.00000000 float
  [0x00000005] -1.00000000 float
  [0x00000006] 0.00000000 float
  [0x00000007] 0.00000000 float
  [0x00000008] -1.00000000 float
  [0x00000009] 0.00000000 float
  [0x0000000a] 0.00000000 float
  [0x0000000b] 0.00000000 float
  [0x0000000c] nan float
  [0x0000000d] nan float
  [0x0000000e] nan float
  [0x0000000f] 1.00000000 float

@LGhassen
Copy link
Owner

LGhassen commented Nov 1, 2024

Oh that should be easy to fix, those should be the 3 values I'm setting manually here https://github.com/LGhassen/Scatterer/blob/dev/scatterer/Utilities/Camera/ReflectionProbeFixer.cs#L64-L66 or here https://github.com/LGhassen/Scatterer/blob/dev/scatterer/Utilities/Camera/ReflectionProbeFixer.cs#L77-L79 adding a NaN check here would probably work. I can add that sometime in the next few days.

LGhassen added a commit that referenced this issue Nov 1, 2024
@LGhassen
Copy link
Owner

LGhassen commented Nov 1, 2024

@JonnyOThan
Copy link
Contributor Author

I think this did work, but it still crashed. The main thread is now processing a camera from singularity:

Call Stack for Thread 35896:
0x00007FFBD996D574 (ntdll) ZwWaitForSingleObject
0x00007FFBD71C920E (KERNELBASE) WaitForSingleObjectEx
0x00007FFB5D152522 (UnityPlayer) [c:\buildslave\unity\build\external\baselib\builds\source\cproxy\baselib_systemsemaphore_cproxy.inl.h:14] Baselib_SystemSemaphore_Acquire 
0x00007FFB5CA0740B (UnityPlayer) [c:\buildslave\unity\build\runtime\jobs\internal\jobqueue.cpp:1653] JobQueue::WaitForJobGroupID 
0x00007FFB5CA04E76 (UnityPlayer) [c:\buildslave\unity\build\runtime\jobs\jobs.cpp:39] SyncFenceNoClear 
0x00007FFB5C86FB48 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\shadows.cpp:1555] PrepareShadowMaps 
0x00007FFB5C8F6E34 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\renderloops\deferredutils.cpp:505] SetupLightContext 
0x00007FFB5C8F6C90 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\renderloops\deferredutils.cpp:535] SetupActiveLightsContext 
0x00007FFB5C8DEE19 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\renderloops\deferredrenderloop.cpp:1656] DoDeferredRenderLoop 
0x00007FFB5C8DFFA8 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\renderloops\renderloopprivate.cpp:500] DoRenderLoop 
0x00007FFB5C8AC0DD (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\camera.cpp:3035] Camera::CustomRender 
0x00007FFB5C8BC9E8 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\camera.cpp:2259] Camera::StandaloneCustomRender 
0x00007FFB5C8B5627 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\camera.cpp:5047] CameraScripting::Render 
0x00007FFB5CBD7B81 (UnityPlayer) [c:\buildslave\unity\build\artifacts\win\core\win64_nondev_m_r\corebindings.gen.cpp:11777] Camera_CUSTOM_Render 
0x0000026839CC3D03 (UnityEngine.CoreModule) UnityEngine.Camera.Render()
0x0000026DC17E84C3 (Singularity) Singularity.ScaledSceneBufferRenderer.RenderSceneIfNeeded()
0x0000026DC17E8223 (Singularity) Singularity.SingularityCenteredCubeMap.UpdateCubeMap()
0x0000026DC17E8193 (Singularity) Singularity.SingularityCenteredCubeMap.OnWillRenderObject()
0x00000269F521DE50 (mscorlib) System.Object.runtime_invoke_void__this__()
0x00007FFB6339D6D0 (mono-2.0-bdwgc) mono_get_runtime_build_info
0x00007FFB63322932 (mono-2.0-bdwgc) mono_perfcounters_init
0x00007FFB6332B98F (mono-2.0-bdwgc) mono_runtime_invoke
0x00007FFB5CB89A6D (UnityPlayer) [c:\buildslave\unity\build\runtime\scriptingbackend\mono\scriptingapi_mono.cpp:633] scripting_method_invoke 
0x00007FFB5CB86E23 (UnityPlayer) [c:\buildslave\unity\build\runtime\scripting\scriptinginvocation.cpp:273] ScriptingInvocation::Invoke 
0x00007FFB5CB71732 (UnityPlayer) [c:\buildslave\unity\build\runtime\mono\monobehaviour.cpp:1215] MonoBehaviour::HandleNotifications 
0x00007FFB5C85CAB2 (UnityPlayer) [c:\buildslave\unity\build\runtime\baseclasses\gameobject.cpp:1256] GameObject::SendMessageAny 
0x00007FFB5C8C5B21 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\culler.cpp:367] CullSendEvents 
0x00007FFB5C8ABC16 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\camera.cpp:1526] Camera::CustomCull 
0x00007FFB5C8B59C1 (UnityPlayer) [c:\buildslave\unity\build\runtime\camera\rendermanager.cpp:318] RenderManager::RenderCameras 
0x00007FFB5CA596B7 (UnityPlayer) [c:\buildslave\unity\build\runtime\misc\player.cpp:923] PlayerRender 
0x00007FFB5CA4B0E7 (UnityPlayer) [c:\buildslave\unity\build\runtime\misc\playerloop.cpp:352] ExecutePlayerLoop 
0x00007FFB5CA4B183 (UnityPlayer) [c:\buildslave\unity\build\runtime\misc\playerloop.cpp:369] ExecutePlayerLoop 
0x00007FFB5CA4D5BC (UnityPlayer) [c:\buildslave\unity\build\runtime\misc\playerloop.cpp:441] PlayerLoop 
0x00007FFB5C80272E (UnityPlayer) [c:\buildslave\unity\build\platformdependent\winplayer\winmain.cpp:220] PerformMainLoop 
0x00007FFB5C80148A (UnityPlayer) [c:\buildslave\unity\build\platformdependent\winplayer\winmain.cpp:1101] MainMessageLoop 
0x00007FFB5C80553C (UnityPlayer) [c:\buildslave\unity\build\platformdependent\winplayer\winmain.cpp:1618] UnityMainImpl 
0x00007FFB5C80902B (UnityPlayer) [c:\buildslave\unity\build\platformdependent\winplayer\winmain.cpp:1658] UnityMain 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants