Indirect VT calculates wrong MaxLevel in shader for non-square textures

When using Indirect Virtual Textures (UVirtualTextureCollection), non-square textures turn grey at distance.

# Cause

UnpackIndirectVirtualTexturePageTableUniform() in IndirectVirtualTextureCommon.ush reconstructs MaxLevel as using max(Info.BlockWidth, Info.BlockHeight), but FAllocatedVirtualTexture() in AllocatedVirtualTexture.cpp calculates it using Min(FullWidthInTiles, FullHeightInTiles). For non-square VTs these disagree, so the indirect path over-estimates the mip count. At distance (high mip levels) the shader reads non-existent mip. Square textures and VTs which don’t use the indirect path are unaffected.

# Fix

Match behavior between c++ and shader. Either both should use min or both max.

[Attachment Removed]

Steps to Reproduce

  1. Use the Indirect VT path (e.g. UVirtualTextureCollection) with a non-square texture (e.g. 2048×1024)
  2. Close up: correct
  3. Move away (higher mips): texture turns grey as shader reads non-existent mip
    [Attachment Removed]

Hello,

Apologies for the delay. This issue was fixed in the following changelist:

CL#53920109 (ed1249) Virtual Texture Collections, new entry packing to avoid mip overlap

- Entries always power of two, packed by first available occupancy mask. Aligned so that all pages are exclusive (block wise) at each mip it can logically request

- Fixed dummy coarse blocks not allowing finer blocks (with actual entries) producing

- Feed in max level instead of computing it

- Added dummy vis

Please let us know if you still see issues after integrating this fix.

[Attachment Removed]

Hello,

thank you for the fix, we will check it out.

[Attachment Removed]