Texture2DArray vs CubeMap
I'm working on some cascaded shadow mapping algorithm. For now, I'm using 4 cascades, layout as a 4 texture atlas in a single texture. This works fine, but is limited to 2048*2048 for each cascade, and 4 cascades max.
I would like to switch to another implementation, with 6 cascades, and I can't use a single texture anymore. So here are my questions :
- is there any easy way to sample a specific face of a cube map in GLSL ? Something like textureCube(vec2 coords, int faceIndex) ?
- is there any performance reason to prefer using CubeMap or Texture2DArray ?
To #1, yes. But since you don't need cross-face filtering and access using a direction vector, why use cube maps?
Originally Posted by Aurelien
To #2, don't know, but a 2D texture array makes more sense here and performs well.
Any reason you can't just make a 2048 x 2048 x 6 2DArray texture?
In my experience, every driver that supports array textures also supports NPOT textures.
Thanks for your answers.
The only reason why I'm asking this is about performances, I've experienced slow texture array access in the past, but it was with older GPUs.