Textures stream in blurry for a moment whenever the player turns the camera quickly; how do you diagnose and fix the texture streamer's priorities?
answer
- requests start too late
- wanted mip vs resident mip
- latency, queue order, pool budget
- ask ahead of the view
basics
~20 sThe streamer asks for detail only once a surface is on screen, so a quick turn reveals textures whose sharp mips are still queued; request around the camera rather than only inside the view, rank requests by on-screen need, and delay eviction.
solid answer
~50 sA texture streamer keeps the lowest mip levels of every texture resident and loads sharper levels asynchronously when the renderer reports needing them, within a fixed memory pool. A fast turn exposes surfaces whose requests only began when they became visible; each must wait for its place in the queue, the read, decompression and making the data available to the GPU, which spans several frames. First measure: request-to-resident latency, queue depth, the wanted-versus-resident gap per texture, and whether the pool is at its budget. If it is, the problem is budget, not order. If not, fix the priorities: request for everything within a radius of the camera or predicted from its rotation, sort requests by how much screen area each missing level would sharpen, give streaming reads priority over bulk background loads, cancel requests that are no longer wanted, and keep recently seen textures for a grace period before evicting them.
go deeper
Recall that textures are loaded in detail levels over time, so a surface can appear blurry while its sharper levels arrive.
Explain the streamer's loop: wanted versus resident level, asynchronous requests, a fixed pool and eviction, and why low levels stay resident.
Instrument latency, queue depth and pool usage to tell a budget problem from an ordering problem, then fix request timing, priorities and eviction.
Set per-platform streaming budgets and the memory a team trades for predictive requests, and decide what the overlay and metrics must show in every build.
## How a texture streamer works A texture's **mip chain** stores it at full resolution and at a series of halved resolutions. Only the levels close to how large the texture appears on screen are needed; which level the GPU samples is decided by the renderer, and that selection is a rendering subject. The streamer's job is to make those levels resident in time, inside a fixed memory budget. A typical loop each frame: 1. The renderer reports, for each texture it drew or expects to draw, the sharpest mip level it wanted. 2. The streamer compares the **wanted level** with the **resident level** and creates requests for the missing ones. 3. Requests are queued for asynchronous reads from the package. 4. Completed reads are decompressed if needed and made available to the GPU, often by a copy into video memory. 5. When the pool is full, the streamer evicts the sharpest levels of textures that are no longer wanted. The lowest mip levels of every loaded texture usually stay resident permanently. They are tiny, and they guarantee that a texture is blurry while it waits rather than missing. ## Why a quick turn exposes blur When the player turns, surfaces that were behind the camera enter the view at once. Several things then conspire: - **Requests start too late.** If only visible surfaces generate requests, nothing for the new view was asked for before it appeared. - **Latency spans several frames.** Queue wait, the read, decompression and the hand-over to the GPU each add time, so a texture can stay blurry noticeably long at a high frame rate. - **Bad ordering.** A first-in, first-out queue serves a hundred small, distant textures before the wall that now fills half the screen. - **Eager eviction.** If textures are evicted as soon as they leave the view, turning back re-requests what was just discarded. - **Starved reads.** Bulk background loads for the next area can occupy the storage queue, so streaming requests wait behind them. ## Diagnosing before fixing The fix depends on which cause dominates, so instrument the streamer first: - per request, the **time from request to resident**, split into queue wait and read time; - the **queue depth** over time, especially right after a turn; - the **pool usage** against its budget; - for each visible texture, the **gap between wanted and resident level**, ideally visualised as an on-screen overlay. If the pool sits at its budget, sharp levels have nowhere to go: reordering requests only moves the blur around, and the answer is a larger pool, lower wanted levels on that platform, or fewer unique textures. If the pool has room but the queue grows after every turn, the problem is ordering or request timing. If queue wait is short but reads are slow, look at what else is using storage bandwidth. ## The fixes | Cause | Fix | |---|---| | Requests only for visible surfaces | request for everything within a radius of the camera, or predict the view from its angular velocity | | First-in, first-out order | prioritise by how much screen area the missing level would sharpen, largest first | | Requests outlive the need | cancel or demote requests whose textures are no longer wanted | | Eager eviction | keep textures for a grace period after they were last wanted, evicting the least recently wanted first | | Background loads hog storage | separate priority classes, so streaming reads are not stuck behind bulk loads | | Missing low levels | keep a small resident base of low mips for every loaded texture | Requesting around the camera costs memory, because textures behind the player now hold sharper levels too; the radius and the predicted window are tuned per platform against the pool budget. The aim is not to remove all blur, which a fast enough camera will always cause, but to make it brief and confined to small, distant surfaces. ## Where this sits The same machinery streams mesh detail levels, audio and animation data; textures are the most visible case because blur is easy to spot. Deciding which world areas to load as the player moves belongs to world organization; the streamer described here serves whatever that layer has loaded, one asset's detail levels at a time.
- Why keep the lowest mip levels of every loaded texture resident permanently?They are tiny, since each level is a quarter the size of the one above, so keeping a small base of them costs little memory. In exchange, a texture whose sharp levels are still loading draws blurry instead of missing or showing a placeholder, and eviction can never leave a visible hole.
- How do you tell a priority problem from a budget problem in a texture streamer?Watch the pool against its budget while reproducing the blur. If the pool is full and wanted levels stay unloaded even with the camera still, there is no room and reordering cannot help: raise the budget or lower what is wanted. If the pool has room but requests queue up after each turn, timing and ordering are the problem.
- Serving texture requests first-in, first-out is fair, so it is good enough.
- Evicting textures the moment they leave the view saves the most memory and costs nothing.
- Reordering requests fixes blur even when the streaming pool is at its budget.
- Blur on a fast turn means the storage device is too slow; nothing else matters.
- Dropping the low mip levels frees room for sharp ones at no visible cost.