Search code examples
iostexturesmetal

Difference between texturecube and texture3d


If I want to store information for a cubic volume, is there any speed/memory advantage if I use any of the two?


Solution

  • It seems like you are under the impression that a "cube" texture is a special case of a 3D texture, but that is not the case. It is actually a cubemap, which is a special case of a 2D texture array, where the slice count is six, and in which each slice has the same dimensions.

    3D textures are also special cases of 2D texture arrays, but their depth isn't fixed at six. That said, I haven't ever had to think about a cubemap as a 3D texture that was six voxels deep. Cubemaps model the flat sides of cubes. 3D textures model the voxels that make up all parts of a box, which might be a cube or not.

    MTLTextureType.Cube https://developer.apple.com/library/prerelease/ios/documentation/Metal/Reference/MTLTexture_Ref/index.html#//apple_ref/c/tdef/MTLTextureType