Each face of a cubemap as an atlas

Hello,

I’m taking my first steps with shadows, so to speak. When dealing with directional lights, I render each depth map to the same texture which works as a shadow atlas. Then I just scale down the projected coordinates and offset them in the final fragment shader. It’s kind of like a spritesheet.

This system works alright. But I’m wondering, can I do something similar with a cubemap for point lamps? I may be wording my searches wrong but I haven’t been able to find any examples of this.

Note that this approach is less than ideal, as the hardware has no knowledge of the boundary between sprites. It’s preferable to use a 2D array texture with a distinct layer for each light. More generally, 2D array textures should be used instead of atlases on any implementation which supports them.

You can’t have a cube map atlas, but you can have a cube map array texture (GL_TEXTURE_CUBE_MAP_ARRAY) with OpenGL 4.0 or the ARB_texture_cube_map_array extension. Note that most of the online reference pages haven’t yet been updated to include these. There is some information on the wiki. From the client side, they mostly behave like 2D array textures with 6×n layers.

Haha, yeah. I reckon any vertex outside the current light frustum would end up sampling from a neighboring depth map, it may get nasty on a cluttered scene.

Guess this is good an excuse as any to look more into array textures. I’m running on seven year old AMD integrated graphics but I think this old girl should be OGL 4.0 capable. We’ll see.

Thank you c: