Ambient occlusion stops at certain camera angles/positions

I'm running Unity 2020.1.15f1, using the built-in renderer and the Post-Processing package. When I run the game, both in Play mode and when I build it, the ambient occlusion sometimes stops when I face certain directions/move to certain positions. I noticed that if I add a directional light to the scene, the problem goes away, but since the game takes place underground, I don't want directional lights. As a workaround, right now I have a directional light with an intensity set to 0.001, but I don't understand why the light is needed anyway. Is there something about how the ambient occlusion works that I'm missing?

[Here's a video of what I'm talking about][1]. I turned the intensity up to the extreme to make it easier to see. There's also a problem with the actual edges not being darkened, so if you happen to have a solution to that, that would also be great!)

My guess is that the depth texture isn’t being generated properly (even though it really should be created automatically by the post-process renderer if using effects that rely on it, so maybe you have a script somewhere that is overriding it?). I would try adding a script to your camera, something along the lines of the following;

private Camera m_Camera;

private void OnPreCull ()
    if (m_Camera == null)
        m_Camera = GetComponent<Camera>();

    m_Camera.depthTextureMode |= DepthTextureMode.Depth;