Post

Virtual Texturing in Unreal Engine 5 (Tips)

With Virtual Textures, you can create and use large-sized textures for a lower memory at runtime.

Virtual Texturing in Unreal Engine 5 (Tips)

Virtual Texturing


Virtual Texturing

With Virtual Textures, you can create and use large-sized textures for a lower memory at runtime.

2 Types:

  • Runtime Virtual Texturing (RVT)
    • Texel data is generated by the GPU at runtime, on demand.
    • Works similarly to traditional texture mapping
    • Ideal for rendering complex materials for Landscapes
    • Only the needed texel tiles are cached in memory as they’re sampled, reducing overall GPU memory usage.
    • More info.

Texel data : A texel (texture element) is the smallest addressable unit of a texture map. “Texel data” thus refers to the raw per-texel information stored in a virtual texture.

  • Streaming Virtual Texturing (SVT)
    • Texel data is cooked into small, fixed-size blocks on disk during packaging.
    • Well suited for lightmaps or large, detailed artist created textures.
    • At runtime, only the visible tiles are streamed in from disk.
    • Reduces texture memory overhead when using larger texture sizes.
    • An alternative way to stream textures from disk.
    • More info.

UDIM U-Dimension is a system used in UV mapping that allows a single 3D model to use multiple texture tiles, each mapped to a different section of the UV space.


Virtual Texture Memory Pools

2 Types:

  • Page Table Memory
    • Indirection from texture coordinates to the texture data
    • Can grow
    • No user controls
    • Only released when all of the contents are released.
  • Physical Memory Pool.
    • Contains the currently resident texture data, and is made up of a number of individual pools.
    • Each texture format has its own pool.
    • Fixed size so can’t grow.
    • User can control the size of each pool.

More info

How Does Streaming Virtual Texturing Work?

In a traditional way, the engine estimates how large a texture will appear on screen based on camera distance amd object size. Then, it only loads the mip levels needed for the current view. But for high-res textures leads to significant performance and memory overhead. Also, even a small part of the object is visible, the entire object is considered visible. That means, all used materials to stream in.

In contrast, the virtual texturing system only streams in parts of the textures that UE requires for it be visible.

  • Only visible parts are loaded
    • Unlike traditional methods where an entire texture is transferred from memory to the GPU, virtual texturing only streams in the sections that will actually appear on screen.
  • Subdivision across MIP levels
    • Each MIP level of a texture is divided into small, fixed-size tiles. No matter how large the full texture is, the system considers only those tiles.
  • GPU-based visibility determination
    • The GPU uses standard depth buffers to figure out which tiles are actually referenced by visible pixels. In other words, the GPU decides “these tiles contain pixels that are on screen.”
  • CPU communication and caching
    • The GPU tells the CPU which tiles are needed, and the CPU then loads just those tiles into the GPU’s memory cache.
  • Memory and performance benefits
    • As a result, even extremely large textures only occupy GPU memory for the bits you can actually see, avoiding unnecessary data transfers and memory use.

I used chatgpt to make my notes more organized.

This post is licensed under CC BY 4.0 by the author.