What the disc says about GS priority: cutout matters, blending barely does

The alpha histogram from 777a6a8 had a consequence sitting in plain sight that I
had only used as a regression guard. It is a prioritisation input.

Measured over every decoded tfrag texture on all 27 levels:

    total texels            23,168,000
    fully opaque (255)      22,690,698   97.94%
    fully clear  (0)           227,497    0.98%
    partial (1..254)           249,805    1.08%
    distinct partial values            126

Two conclusions, and they point in opposite directions from the one I would have
assumed.

The 0x80 -> 1.0 rule is not an edge case to be got right eventually. It is what
22.7 million texels -- 97.94% of every pixel of terrain on the disc -- are
already doing. Getting it wrong is not a subtle shading difference, it is the
texture decode being wrong almost everywhere.

But blending is close to irrelevant at this level: partial alpha is 1.08% of
texels. A correct but imperfect blend path costs almost nothing visually; a
correct alpha *test* is what determines whether foliage, fences and cutaway
geometry exist at all. That reorders the remaining GS work, where I had been
planning to do blending and the cutout together.

The 126 distinct partial values are also evidence about what they are. If the
partial alpha were a blend ladder or a dither, it would populate a handful of
values. It populates all 126 evenly, which is what smooth alpha looks like --
soft edges and distance fade, not discrete states.

Caveat worth stating: these are tfrag textures, so this is a statement about
terrain. Moby and sky alpha may behave differently and are not covered by this
measurement.

Test count read from the raw result lines per AGENTS 3b, with the disc present:
278 passing, clippy clean.
This commit is contained in:
2026-10-14 04:42:59 +02:00
parent 1982f545f1
commit 25d73b4fa8
+10
View File
@@ -721,6 +721,16 @@ lookup, and it is the main thing inherited from ReRAC.
through bevy's sampler rather than wgpu directly. One is now wired: the
texture sampler was `..default()` with a comment claiming it clamped, and
bevy's default is `Repeat` -- see `image_of` in `crates/gc-engine`.
**What the disc says about priorities.** Measured over all 23,168,000 texels of
every decoded tfrag texture on 27 levels: **97.94% fully opaque, 0.98%
fully clear, 1.08% partial across 126 distinct values.** So the `0x80 -> 1.0`
rule is not a corner case -- it is what 22.7 million texels do -- while
blending touches about 1% of them. **Alpha testing (cutout) matters far more
than alpha blending on this disc**, and the 126 evenly-populated partial
values look like smooth alpha (soft edges, foliage, distance fade) rather
than a quantised blend ladder. That reorders the remaining GS work: the
cutout path is the one that has to be right.
**No draw-path or shader work has started.**
- [ ] VU0/VU1 skinning and lighting on the PS2 float model
- [ ] LOD/morph/cull per `TfragProc` and `TieProc`