PDA

View Full Version : Texture2DArray vs CubeMap



Aurelien
10-13-2013, 04:05 PM
Hi,

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 ?

Thanks

Dark Photon
10-14-2013, 05:32 PM
...cascaded shadow mapping algorithm. ...would like to switch to ... 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?

To #2, don't know, but a 2D texture array makes more sense here and performs well.

arekkusu
10-14-2013, 08:53 PM
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.

Aurelien
10-15-2013, 12:22 AM
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.