Graphics quality on phones and desktops: the device's quality tier
A world is authored on one machine and played on every other. The engine
assigns each device a quality tier at boot, "low", "medium" or
"high", from what the device states about itself: its GPU family and limits,
its memory, and its display (a phone or a touch browser states a density; a
desktop window states none). Every renderer default a world's settings leave
unstated comes from that tier, so a world that never mentions phones still
plays on one at the phone's defaults.
local q = renderer.qualityTier()
print(q.tier, q.reason)
-- medium Mali-G78 is a mali GPU of the medium class; 7.0 GiB of memory
print(q.defaults.resolutionScale, q.defaults.anisotropy)
print(q.defaults.shadows.distance, q.defaults.shadows.updateRate)
| Default | high | medium | low |
|---|---|---|---|
| Texture budget | the device's own | at most 768 MiB | at most 384 MiB |
Anisotropy (render.anisotropy) | 16 | 8 | 4 |
| Scene on a handheld display | 2.25 px per point, 2.4 Mpx at most | 2.0 px per point, 1.3 Mpx | 1.75 px per point, 0.8 Mpx |
| Scene on a desktop display | every pixel | 1.3 Mpx at most | 0.8 Mpx at most |
Shadows. Each tier states the shadows it draws (q.defaults.shadows).
On a handheld they are the largest share of a frame a tier decides after the
render scale.
Shadows (defaults.shadows) | desktop and browser (high) | handheld (high) | medium | low |
|---|---|---|---|---|
How far the sun shadows (distance, render.shadow_distance) | the far plane (0) | 64 | 48 | 32 |
Levels coarser than each receiver's footprint (detailBias) | 0 (1 in a browser) | 1 | 1 | 1 |
Depth the sun's pages hold (budgetMegabytes) | 64 MiB | 24 MiB | 12 MiB | 8 MiB |
Pages one run draws at most (pagesPerUpdate) | every page (256 in a browser) | 256 | 128 | 64 |
Shadow updates a second at most (updateRate) | every frame (0) | 60 | 30 | 30 |
Lookup filter (filter) | wide | narrow | narrow | narrow |
Spot, area and point lights cast (localLights) | yes | yes | yes | no |
The sun's clipmap holds the levels that reach its distance, so a shorter one
marks, culls and draws fewer pages, and receivers past it read unshadowed.
The update rate bounds how many times a second the main camera's shadow
pages, the sun's and every local light's, are marked, culled and drawn: a frame that comes sooner than the rate allows
samples the pages the last update left, so a tablet running at 120 frames a
second updates its shadows on every second frame, and one running below 60
on every frame. The wide filter
takes four rotated gathers over 4x4 texels for a soft, stable edge; the
narrow one takes a single gather over 2x2, a quarter of the texture reads.
The filter shapes the fixed edge a softness of 0 draws: a softness
renderer.setShadowConfig states above 0 widens the penumbra with the wide
filter's kernel under either.
A desktop, and a touch screen over a GPU outside the handheld families with
memory of its own (a touch laptop's discrete GPU), is "high": the renderer
as a desktop runs it. A
handheld starts at the tier its GPU's generation affords (Adreno 7xx,
Immortalis and Mali-G7xx are high; Adreno 6xx and Mali-G57 to G78 medium;
PowerVR, Mali-G52 and older low; an integrated GPU outside these families, or
one stating no kind, medium; an emulator's or a virtual machine's GPU, which
draws from the system's memory, high) and is held down by its memory (under
about 4.5 GiB is low, under 6.5 GiB medium) and by a GPU that cannot hold an
8192-texel texture.
The scene within a pixel budget. Shading cost is pixel count, and each
tier states the most pixels the scene renders at (2.4 million at high, 1.3 at
medium, 0.8 at low), held against the size the scene is shown at: the Scene
panel's in the editor, the window's in a player. A scene inside the budget
renders one scene pixel per display pixel. A larger one renders at the scale
that fits the budget (a 5120x1440 window at high: 0.57 of each side;
2560x1440: 0.80; 1920x1080 is inside it) under
renderer.setResolutionScaleMode("reconstruct"), so the UI and text compose
at the display's full resolution on top of the scene brought up to it. A phone
panel packs far more pixels than a 3D scene shows at arm's length, so on a
handheld the tier also renders the scene at its own density, whichever is
smaller (renderer.resolutionScale() reads below 1 on a 1080x2400 phone).
How the scene is brought up to the display is the tier's too,
renderer.qualityTier().defaults.sceneReconstruction: "temporal" at the high
tier off a handheld, where the frames are reconstructed into the display's
pixels by the engine's temporal upscaler (@builtin::systems.temporalUpscale,
the same on every platform); "blit" on a handheld and at the lower tiers, which
interpolate the one frame and spend no frame time on it. A reconstruction a
world enables itself (TemporalUpscale) stands over the tier's. A lower tier
chosen on a desktop (a player's "low graphics") renders within that tier's
budget the same way, so renderer.setQualityTier alone is a whole graphics
setting on every platform.
Overriding. Three levels, each standing over the one before:
- The world's settings: a
render.*key the world's settings state (render.anisotropy,render.shadow_distance) is used on every device, whatever its tier. renderer.setQualityTier("low" | "medium" | "high")chooses another tier for the process (a settings screen offering the player a quality choice is this call);renderer.setQualityTier()returns to the device's own. The choice holds across scene loads, and a change of tier applies the new tier's defaults at the call, replacing what an earlier renderer call set for them; choosing the tier already in force changes no setting.- A single renderer call (
setResolutionScale,setTextureBudget,setAnisotropy) overrides that one default until the tier changes again, including a call made in the same script right aftersetQualityTier. AsetTextureBudgetbudget stands over the tier's texture cap untilsetTextureBudget()returns it to the device's own. A shadow settingrenderer.setShadowConfigstates (detailBias,budgetMegabytes,pagesPerUpdate,updateRate,filter,localLights) stands over the tier's through every change of tier, until it is set back to"default"; itsdistancestands until the tier or the world'srender.shadow_distancemoves it.
The engine log states the tier and every default it chose at boot, and again
whenever the tier changes ([quality] lines).
Volumetric effects
Every volumetric effect draws at a quality level, "low", "medium" or
"high", and starts at the level the tier in force puts it at
(@builtin::modules.qualityLevels): a desktop's or a browser's high tier draws
high, a handheld's high tier and every medium tier medium, the low tier
low. high is the effect as authored, the picture a desktop has always
drawn; the lower levels draw the same effect with a stated share of its work.
renderer.setQualityTier moves every effect following the tier on its next
frame, so the one call stays a whole graphics setting.
Effect (its quality setting) | high | medium | low |
|---|---|---|---|
Light scattering (VolumetricLighting.quality, volumetricLighting.set) | grid 1/2 of the frame per axis, all steps and shadowSteps | grid 1/3, 60 % of steps, 67 % of shadowSteps | grid 1/4, 50 % of each |
Aerial perspective (PhysicalAtmosphere.quality, atmosphere.set) | all aerialSteps | 75 % | 50 % |
Participating media (mediaTransmittance.set({ quality })) | all steps | 67 % | 50 % |
Clouds (VolumetricSky.quality, volumetricSky.configure) | renderScale, maxSteps, shadowSteps, stepSize as stated | renderScale x1.5, 75 % of the steps, stepSize x1.25 | renderScale x2, 50 % of the steps, stepSize x1.5 |
Voxel volumes, smoke and fire (Volume.quality, VolumeSequence.quality, Smoke.quality, Fire.quality, Volume:draw) | stepSize, maxSteps, shadowSteps and lights as stated, over the whole frame | steps 1.5 times as long, 67 % of the cap and of shadowSteps, half the lights, over 1/2 of the frame per axis | twice as long, 50 % of the cap and of shadowSteps, a quarter of the lights, over 1/2 of the frame per axis |
Height fog is a closed-form integral, one pass per pixel, and draws the same at every tier. The atmosphere's sky and its tables are the same at every level.
A world names a level for an effect to hold it on every device (quality = "high" on the component, or the module's set), and "auto" (the default)
hands it back to the tier. Each effect reports the level in force and what it
draws there: volumetricLighting.drawn(), atmosphere.drawn(),
mediaTransmittance.drawn(), volumetricSky.drawnLevel() and
Volume.draws().
What each level costs, in GPU milliseconds per frame (the least of a 64-frame
window, read twice; profiler.gpuFrame()), with every effect at its defaults
in one scene: HeightFog, PhysicalAtmosphere with its sky, a
VolumetricLighting medium under the sun and two lamps, eight
ParticipatingMedium boxes, a default VolumetricSky and one Volume. The
render scale is held at 1, so each row is the level's own saving.
| Effect | desktop native, 1920x1080: high / medium / low | browser (Chrome, WebGPU), 840x632: high / medium / low |
|---|---|---|
Light scattering (vol_scatter, vol_lights, vol_composite) | 0.83 / 0.29 / 0.19 | 0.27 / 0.15 / 0.11 |
Aerial perspective (atmo_aerial, atmo_composite) | 0.149 / 0.149 / 0.146 | 0.061 / 0.061 / 0.058 |
Participating media (media_view, media_shadow_apply) | 0.44 / 0.41 / 0.35 | 0.24 / 0.21 / 0.19 |
Clouds (cloud_raymarch, cloud_taa) | 0.88 / 0.46 / 0.28 | 0.63 / 0.47 / 0.30 |
Voxel volume (volume_draw) | 0.098 / 0.078 / 0.067 | 0.083 / 0.064 / 0.054 |
Height fog (height_fog) | 0.051 at every level | 0.019 at every level |
Atmosphere tables (atmo_transmittance, atmo_multiscatter, atmo_skyview) | 0.37 at every level | 0.32 at every level |
Both columns are one discrete Intel GPU (BMG G31, Vulkan); a tier change also moves the render scale, which scales every row again. In published worlds, at 1920x1080 on the same GPU: Tsukimichi's light scattering 1.85 / 0.54 / 0.25 ms, Beechwood Brook's 0.29 / 0.16 / 0.13 ms; Cloudburst draws only height fog through the engine (0.10 ms at every level).
Post effects
The post effects with a cost to trade draw at a quality level the same way,
through the same @builtin::modules.qualityLevels reading of the tier: a
desktop's or a browser's high tier draws high, a handheld's high tier and
every medium tier medium, the low tier low, and "auto" (the default)
follows renderer.setQualityTier on the next frame.
| Effect (its level setting) | high | medium | low |
|---|---|---|---|
Temporal antialiasing (TemporalAntiAliasing.quality, temporalAntiAliasing.enable) | the accumulation, its shown picture sharpened by sharpness | the accumulation unsharpened: the sharpening pass and the copy of its result leave the frame | the same as medium |
Screen-space reflections (ScreenSpaceReflections.quality, ssr.set, the feature's quality) | 64 march steps, 4 refinement steps, 8 gathered rays | 40, 3, 4 | 24, 2, 4 |
Depth of field (DepthOfField.level, depthOfField.set({ level })) | every one of quality's samples | 67 % | 50 %, never fewer than 8 |
Motion blur (MotionBlur.quality, motionBlur.set) | every one of samples | 75 % | 50 %, never fewer than 4 |
Ambient occlusion (AmbientOcclusion.quality, ao.set) | ao.qualityLevels() states each level's slices, steps, rays and resolution |
ultra stays a level the reflections and the occlusion take when named. The
edge antialiasing, the contrast-adaptive sharpening, the debanding and the
lens effects are one pass each over the picture, and the exposure meter one
pass reducing it to a 32x32 grid; each draws the same at every level.
A world names a level to hold an effect on every device, and each effect
reports the level in force and what it draws there:
temporalAntiAliasing.drawn(), ssr.drawn(), depthOfField.drawn() and
motionBlur.drawn().
What each level costs, in GPU milliseconds per frame (the least of the
medians of several 16-frame windows, read twice; profiler.gpuFrame()), the
render scale held at 1, so each row is the level's own saving. The default
world is a new world's own post set: temporal antialiasing, the display
transform and the output stage.
| Post work | desktop native, 1920x1080: high / medium / low | browser (Chrome, WebGPU), 840x632: high / medium / low |
|---|---|---|
| The default world's whole post chain | 0.65 / 0.59 / 0.59 (13 / 11 / 11 passes) | 0.23 / 0.20 / 0.20 (13 / 11 / 11 passes) |
Screen-space reflections (ssr_trace, ssr_resolve) | 1.15 / 0.72 / 0.64 | 0.24 / 0.16 / 0.15 |
Depth of field (dof_coc, dof_gather) | 0.31 / 0.23 / 0.19 | 0.10 / 0.08 / 0.07 |
Both columns are one discrete Intel GPU (BMG G31, Vulkan), which other
engines share, so each figure is the quietest window rather than every one.
Motion blur's samples are spent only where something moves (mb_gather
reads 0.04 ms on a still frame at every level). In a published world, at
1920x1080 on the same GPU, Tidewater's post chain (its antialiasing, an
underwater pass and the display passes) reads 1.05 ms over 21 passes at
high and 0.96 ms over 19 at low.
On a Galaxy Tab S11 (Mali-G925, the native app, render scale 0.76 at a
1530x959 composite) the high tier is a handheld's and draws medium. There
the antialiasing's sharpening and its copy cost 0.41 ms that medium leaves
out, screen-space reflections read 3.87 / 2.40 / 1.76 ms and depth of field
1.18 / 0.78 / 0.67 ms at high / medium / low, and a scene running all
four effects spends 10.3 ms of post work at high and 8.2 ms at the device's
own medium.
Settings that follow the tier, in any asset
A setting declared with a Field descriptor can state how it scales below the
look it is authored at, in the declaration itself, with Field.scaled; a
render feature's settings are read at the level in force. The authored
value is the high look; the rule states medium and low:
settings = {
raysPerProbe = Field.scaled(Field.integer(8, 256, 48, NoSync, "Rays each probe shoots."),
{ medium = 0.67, low = 0.33, least = 16 }), -- a share of the authored value
updateEvery = Field.scaled(Field.integer(1, 8, 1, NoSync, "Frames apart."),
{ low = 2, spends = "cpu" }), -- larger is cheaper: a share above 1
quality = Field.scaled(Field.enum({ "low", "medium", "high" }, "high", NoSync, "Technique."),
{ medium = "medium", low = "low" }), -- a cheaper technique, by value
}
by = "share"(numbers and numeric vectors): the level's value is the authored one times the share, rounded for a whole number, held atleastor above,mostor below, and inside the field's range; a bound never moves it past the authored value.by = "value"(every other kind): the level's value replaces the authored one, and must be a value the field takes. Withorder(the field's values, cheapest first, e.g.{ false, true }or{ "low", "medium", "high" }) it stands only where it is cheaper than the authored value, and an authored value outsideorder(such as"auto") stands at every level.- A level the rule leaves out takes the level above it;
highis never stated. spendsnames which of the frame's budgets the setting costs:"gpu"(the default),"cpu"or"memory", or a list.
The level in force is the one the tier puts effects at (the table under
"Volumetric effects": a handheld's high tier is medium), so
renderer.setQualityTier moves every scaled setting on the next frame. A
render feature's render(ctx) reads the values of that level as
ctx.settings and the authored values as ctx.authored;
renderer.feature.settings(h) reads the authored values, which configure
writes. A look that depends on the authored value of a scaled setting reads
both: a march whose weight falls by decay at each of samples steps keeps
the same falloff over the same distance at a level that takes fewer steps
when it raises decay to the power ctx.authored.samples / ctx.settings.samples.
local s, a = ctx.settings, ctx.authored
local decay = s.decay ^ (a.samples / s.samples) -- the authored falloff, over fewer steps
To see what each device draws:
local r = renderer.feature.resolved("@builtin::systems.probeGI.probeGI")
print(r.level, r.values.raysPerProbe) -- the level in force, and what it reads
for name, row in r.scaled do print(name, row.authored, row.medium, row.low) end
The built-in lighting members declare their cost settings this way, so a scene lit on a desktop draws the same members, each doing less, at the lower levels (values as shares of what the setup authors, rounded):
| Member setting | medium | low |
|---|---|---|
probe GI cascades | 0.75 | 0.5 (at least 1) |
probe GI raysPerProbe | 0.67 | 0.33 (at least 16) |
probe GI updateEvery, visibilityUpdateEvery | as authored | twice as many frames apart |
probe GI maxLocalLights | 0.75 | 0.5 |
probe GI applyScale | as authored | 2 (half resolution) where authored 1 |
ambient occlusion quality | medium where authored above it | low |
contact shadows steps | 0.75 | 0.5 (at least 4) |
contact shadows localLights (the point, spot and distant lights' traces) | off: the sun alone | off: the sun alone |
sky light faceSize | 0.75 | 0.5 (at least 16) |
sky light recaptureInterval | twice as long | four times as long |
The sun's shadows follow the tier's shadow defaults above, and the scene's render scale its pixel budget.
Budgets. Each level states what a frame may spend, as data
(qualityLevels.BUDGETS, and a world's settings quality.<level>.gpu_ms,
.cpu_ms, .memory_mb, .adaptive, .dynamic_resolution, .min_scale over
it):
| Level | GPU (own time, median) | CPU (engine thread, mean) | memory (process private) | governed | render scale follows the GPU budget |
|---|---|---|---|---|---|
high | no budget | no budget | no budget | no | no |
medium | 14 ms | 14 ms | 65 % of the addressable memory | yes | yes, down to 0.5 |
low | 28 ms | 28 ms | 40 % of the addressable memory | yes | yes, down to 0.5 |
The addressable memory is renderer.deviceMemory().system.addressableBytes:
the system's RAM, or less where the process cannot address all of it (a browser
page has 4 GiB of address space), so 2528 and 1556 MiB on a phone with 3.8 GiB.
Where the system states none, as in a browser that gives none, the budgets are
2560 and 1536 MiB.
What the device states of its memory, how to run the world as if on a smaller
GPU, and which source of pressure holds textures at a coarser level are in the
rendering-budgets guide (guides { path = "topics/rendering-budgets" }).
Dynamic resolution. At a governed level the scene's render scale holds
the frame to the level's GPU budget in every world, with no component to add:
the governor hands the scale to @builtin::systems.renderScale.renderScale
(followBudget), which moves it between the level's floor (min_scale, 0.5)
and the scale the tier chose, so a frame inside the budget renders exactly as
the tier states and a heavier one gives up sharpness first. Below the
display's resolution the scene is brought up before the UI is drawn, so text
stays sharp; at medium and low the scene is brought up by the blit. A world's
own DynamicResolution (or a RenderScale.set call) takes the scale over, a
scale written with renderer.setResolutionScale makes the budget stand aside
until the tier chooses its scale again (another tier, or a display of another
size, puts the tier's scale in place of the written one), and
quality.<level>.dynamic_resolution = false hands the scale back to the tier. The scale moves at most once per 30 frames and
only when the frame is more than 10 % off the budget, so it settles rather
than swinging.
A scaled setting names the budget its cost falls on with spends. At a
governed level, every 30 frames the governor reads the frames' GPU and CPU
time (profiler.frameCost), and every 20 seconds the process's memory. A
budget over its limit for three readings in a row steps the settings that
spend it one level below the device's; ten readings under 70 % of it step
them back. The render scale answers the GPU first: while it still has room
above its floor a reading over the budget is left to it, and while it sits
below the tier's scale a reading under the budget is too, so the settings
step back up once the scene has its resolution back. Memory only steps down,
since the settings that spend it (field sizes, tables, pools) are made again
when they change. Each setting is drawn at the
lowest level of the budgets it spends.
local s = qualityLevels.state()
print(s.level, s.levels.gpu, s.levels.cpu, s.levels.memory)
for _, c in s.changes do print(c.budget, c.from, c.to, c.reading, c.limit) end
The Statistics overlay shows the level, each budget's, and the governor's
last step, and the engine log states every step ([quality] lines).
renderer.feature.resolved(h).levels names the levels a feature's settings
were drawn at.
@builtin::modules.qualityLevels resolves any schema the same way
(resolve, table, valueAt), for content that hands settings to code of
its own.
A graphics setting players choose
A settings panel offering "Low / Medium / High" needs one call per choice; the tier carries every default with it, the render scale included, on a phone and on a desktop alike:
-- A button's handler. The choice holds for the process, across scene loads
-- and reloads, so nothing has to re-apply it when a scene loads.
local function choose(tier: string?)
local q = renderer.setQualityTier(tier) -- nil: back to the device's own
print(q.tier, q.defaults.resolutionScale, q.defaults.anisotropy)
end
renderer.qualityTier().tier is the choice in force (the one to highlight in
the panel) and deviceTier the device's own. A choice that should outlast the
process (the next launch of the app) is the world's to store, in the player's
runtime_data, and to hand back to renderer.setQualityTier at startup.
Seeing what it costs
profiler.gpuFrame() times the shadow passes (scene.shadow.mark,
scene.shadow.cull, scene.shadow.raster, scene.shadow.raster.static) and
the lookup inside scene.resolve, renderer.shadowPageStats() counts the
pages each run draws, and renderer.renderTargets() and
renderer.shadowMemory() name the memory the tier's defaults buy, and renderer.viewportSize() / renderer.compositeSize()
the scene raster and the display it is carried up to. Read them before and
after renderer.setQualityTier to see what a tier spends on this device.