What a shader costs on a Quest 3, 259 of them measured
Fruitland is the platformer I am making for the Quest 3, in the browser. Along the way I wanted it to look richer:
when I looked at astrobot rescue mission there were a LOT of shader effects
and a day later, some polish would also be nice, more animations and fx / shaders.
By 21 October the effects were what cost the frames:
the lemonade glass level also is slow af and idk why. the glass-y materials literally look like shit but they make the framerate drop by an insane amount. Again: how would nintendo do it?
didnt we already know htat snow globe's fps drop comes from the "glass" dome? for some reason whatever material you are using is costing insane amount of compute
That week the game also took a native
detour to find out what WebXR costs, and the work moved to my desktop, because
my laptop is truggling with the current workload
. On the morning of 25 October the
desktop had lost its wireless connection to the headset:
ok so development has been going on on desktop for a while so dont do anything on the game but desktop cant wifi connect anymore to the headset adb. can you? I am wearing it so you should be able to
The laptop got it back over a cable. The desktop then spent the day measuring shaders, and that afternoon the result went up as a public table. That session ran on the desktop, so the notes this blog is written from don't include it. What follows comes from the page and its data.
How it measures
Each shader is drawn full-screen into both eyes at the Quest 3's resolution (1680×1760
an eye, 4× MSAA). On the headset the eye pass is timed with Meta's
ovrgpuprofiler, minus a flat-colour baseline, and scaled to the GPU's top clock of
640 MHz: a cheap shader lets the Quest clock down, which would make it look more expensive than
it is. The same frame is timed on a GeForce GTX 1070 in Chrome, with WebGL's timer queries.
Each row also says what the shader's licence allows, because most of Shadertoy is
non-commercial and Fruitland is meant to be sold.
There were two batches. The first was 50 shaders picked by hand, 11 of them written for the bench as pairs: the same effect once from maths and once from a texture lookup. The second was 209 more, collected by tag (water, fire, toon, aurora, candy and more), with Godot canvas shaders ported mechanically.
Maths against lookups
The hand-made pairs give the clearest answer. Five octaves of value noise, the usual cloud pattern, cost 3.64 ms an eye pass on the Quest when computed, and 0.12 ms when each octave is one lookup in a 256×256 noise texture. Two scrolling layers of noise, the cheap way to draw juice or water: 4.77 ms from maths, 0.01 ms from a texture. On the GTX 1070 the same pairs differ far less, so a desktop preview hides it.
fbm-5-tex is the same five octaves from a texture.Where the PC time is large enough to compare, the Quest takes about four times as long as the GTX 1070 (median 4.3×), up to 13.6× for a tileable water caustic. Per-pixel arithmetic weighs more on the headset than texture reads do.
Glass
Back to the question of how Nintendo would do it. The glass category has three entries. Glass with caustic, from Shadertoy, is the second most expensive shader in the whole table: about 178 ms an eye pass, estimated, which is more than twenty frames' worth at 120 Hz. The bench's own Fake glass ball, a screen-space ball that refracts a procedural backdrop with a fresnel rim and a highlight and never copies the screen, costs 0.06 ms.
- shaders
- 259: 202 from Shadertoy, 46 from godotshaders.com, 11 written for the bench
- on the Quest
- 166 timed; 126 of them fit in 8.3 ms, a whole frame at 120 Hz, and 28 shaders don't register above the flat-colour baseline
- licences
- 82 allow commercial use, 164 don't, 13 unclear; Shadertoy code that states nothing is CC BY-NC-SA 3.0
- method
- both eyes at 1680×1760, 4× MSAA; Quest via
ovrgpuprofiler, scaled to 640 MHz; PC on a GTX 1070 (ANGLE, Direct3D 11) viaEXT_disjoint_timer_query_webgl2, median of nine batches - built
- 25 October, measured and published the same day; dated the 24th because the 25th was taken
- size
- one 12.7 KB HTML page reading three JSON files (catalogue, PC results, Quest results) and a preview image per shader
Still rough
93 shaders of the second batch were never put on the headset: anything over 6 ms on the GTX 1070 was skipped by a guard. Their Quest column is empty, although the intro speaks of 259 timed shaders.
The cheap end can't be ranked. 28 shaders read 0.00 ms on the Quest, so their order there is meaningless.
A full-screen quad is the worst case. In a game a water or glass shader covers part of the screen, on a mesh, behind other things, so these are upper bounds for comparing shaders, not the price of a level.
The licence column is a reading of what each source states, not legal advice; the page says so too.