I’ve got basic directional shadow mapping working and now I’m looking into improving this using technique called “Cascaded Shadow Mapping”, where you use several depth textures to get better quality shadows.
More specifically, I believe I can use GL_TEXTURE_2D_ARRAY as my depth attachment to my FBO and specify the number of cascades in glTexImage3D. The problem is I do not understand how the rendering to the depth attachment works when you’ve got a texture array and I cannot find any examples of this (only examples where you render into color attachments). For example, how is the range determined when selecting which texture to render depth into? How do I access the right layer in the fragment shader during the lighting process?