Virtual texture array

Hi Pedro,

The Texture2D and Texture2DArray assets map directly to structures provided by graphics APIs and are hardware accelerated in nearly all platforms, which allows them to take full advantage of hardware samplers, hardware caching and other low-level optimizations.

Virtual Textures, on the other hand, are very complex software abstractions implemented by Unreal Engine on top of graphics APIs. They require a custom sampling strategy to handle efficient indirect access of texture tiles that can be streamed in and out on demand. A single Virtual Texture uses several Texture2Ds (and maybe even several Texture2DArrays) under the hood.

Implementing some form of Virtual Texture Arrays would probably be a great undertaking for the engine, and so far it seems that the devs have not considered that it would be worth the required development time. Note that, in most cases, Virtual Textures should probably not be used where a simple Texture2D would suffice.

Now, from your older question, I see you are attempting to use large UDIM textures, combined with the ability to select a different appearance on a material based on a mask texture (which can be done more conveniently and efficiently by using Texture2DArrays rather than multiple Texture2Ds). Unfortunately, Unreal added support for UDIM using Virtual Textures as the underlying technology, and Arrays of Virtual Textures are not supported in the same manner as Texture2DArrays, which means that even today you must choose between using Texture2DArrays without UDIM support, or multiple individual Virtual Textures with UDIM support.

Currently, you will likely have to choose one of these approaches:

A) Use multiple independent Texture2DArrays, one for each region that would correspond to a UDIM tile, and work without UDIM. Select which array to sample from based on the tile of the current coordinates, and which array index to sample from based on the mask.

B) Use UDIM with multiple Virtual Textures, one for each area identified by the mask. Select which virtual texture to sample from based on the mask, and let it handle UDIM.

At a first glance, I’d guess that using Texture2DArrays should perform better, although it probably requires more work and more GPU memory usage. On the other hand, I’m not sure of how relevant would the performance difference actually be, because when using the Virtual Textures approach, only one of them will probably be accessed on each fragment on the material.

If you’d like, I can try to ask Epic staff if there are any plans to support Virtual Texture Arrays in the future. As I said, a completely general implementation to support openworld landscapes and other huge-area use-cases seems like a big undertaking, but an implementation restricted to UDIM support, where all textures of the array from each tile are always accessed in exactly the same way over a not-so-big model, might be a manageable idea.

Best regards,

Vitor