3D engine that AI agents drive
Explain offRay by colour step and bound true flips on the Melbourne drape (part of #751)
Nguyen Xuan An303f57700fea
diff --git a/bench/flicker/ground-truth.js b/bench/flicker/ground-truth.jsindex 60a21285..b6f548a3 100644--- a/bench/flicker/ground-truth.js+++ b/bench/flicker/ground-truth.js@@ -18,6 +18,9 @@ const NORMAL_KEY_SCALE = 100;const COLOUR_KEY_SCALE = 1e7;export const DEFAULT_COLOUR_THRESHOLD = 40;const MINIMUM_REFERENCE_PIXELS = 3;+// A shown colour this close (largest channel, in bytes) to the one the ray cast expects is a rounding step of the frame, not another face.+const OFF_BY_ONE_STEP = 2;+const SMALL_COLOUR_GAP = 16;function transformPoint(matrix, x, y, z, target, offset) {target[offset] = matrix[0] * x + matrix[4] * y + matrix[8] * z + matrix[12];@@ -140,7 +143,7 @@ function touchesOwnerChange(owner, width, pixel) {// hits) the pixel is swapped, and it is flipped when the face has no higher rank than the one the ray cast puts in front. A face// that is not on the ray is the rasteriser and the ray cast disagreeing about a pixel centre (offRay), and a colour that names no// face is a blend of two (blended). Neither is depth fighting.-function classifyExactMismatch(result, mismatchMask, { pixels, pixel, width, world, cast, keyByColour }) {+function classifyExactMismatch(result, mismatchMask, { pixels, pixel, width, world, cast, keyByColour, expected }) {const shownKey = keyByColour.get(`${pixels[pixel * 4]},${pixels[pixel * 4 + 1]},${pixels[pixel * 4 + 2]}`);if (shownKey === undefined) {result.blended++;@@ -149,8 +152,13 @@ function classifyExactMismatch(result, mismatchMask, { pixels, pixel, width, worconst rank = shownRank(world, cast, pixel, shownKey);if (rank < 0) {result.offRay++;- if (touchesOwnerChange(cast.owner, width, pixel)) result.offRayEdge++;+ const gap = channelDistance(pixels, pixel * 4, expected);+ const atEdge = touchesOwnerChange(cast.owner, width, pixel);+ if (atEdge) result.offRayEdge++;else result.offRayInterior++;+ if (gap <= OFF_BY_ONE_STEP) result.offRayNearColour++;+ else if (gap <= SMALL_COLOUR_GAP) result.offRaySmallGap++;+ if (!atEdge && gap > SMALL_COLOUR_GAP) result.offRayUnexplained++;return;}result.swapped++;@@ -170,8 +178,11 @@ function classifyExactMismatch(result, mismatchMask, { pixels, pixel, width, wor* - `offRay` and `blended`: with `exact`, wrong pixels that show a face not on the ray, or no single face (see classifyExactMismatch);* - `offRayEdge` and `offRayInterior`: `offRay` split by whether the pixel touches an owner change of the ray cast in its 3x3* neighbourhood. Edge pixels are the rasteriser and the cast disagreeing about a pixel centre. An interior pixel has no such excuse:- * its face may be one deeper than `hitsPerPixel` of the cast, which would be a real flip, so `flipped + offRayInterior` is the- * upper bound of true flips (see `flipUpperBound`);+ * its face may be one deeper than `hitsPerPixel` of the cast, which would be a real flip. `offRayUnexplained` is the interior part+ * whose shown colour is also more than 16 bytes from the colour expected there, so `flipped + offRayUnexplained` is the upper bound+ * of true flips (`flipUpperBound`);+ * - `offRayNearColour` and `offRaySmallGap`: offRay pixels whose shown colour is within 2 bytes, or 3 to 16, of the colour the ray cast+ * expects. Triangle numbers are neighbours in colour, so a rounding step of the frame can name another, unrelated triangle.* - `flipped`: with `exact`, the swapped pixels where the face shown has no higher rank than the face the ray cast puts in front, so* a face behind covers one in front and nothing in the scene asked for it: a true visibility flip. The rest of `swapped` is* `ranked`, a face that the flush pass deliberately lifts over the nearer one inside its bias, which is stable and not flicker;@@ -205,7 +216,7 @@ export function compareWithGroundTruth({ pixels, world, cast, width, height, exaconst source = bucket.cleanCount >= MINIMUM_REFERENCE_PIXELS ? bucket.clean : bucket.any;if (source[0].length >= MINIMUM_REFERENCE_PIXELS) references[key] = source.map(median);});- const result = { contested: 0, wrong: 0, swapped: 0, tied: 0, unjudged: 0, edge: 0, flipped: 0, ranked: 0, offRay: 0, offRayEdge: 0, offRayInterior: 0, blended: 0 };+ const result = { contested: 0, wrong: 0, swapped: 0, tied: 0, unjudged: 0, edge: 0, flipped: 0, ranked: 0, offRay: 0, offRayEdge: 0, offRayInterior: 0, offRayNearColour: 0, offRaySmallGap: 0, offRayUnexplained: 0, blended: 0 };const keyByColour = new Map();references.forEach((reference, key) => { if (exact) keyByColour.set(reference.join(','), key); });const mismatchMask = new Uint8Array(width * height);@@ -231,7 +242,7 @@ export function compareWithGroundTruth({ pixels, world, cast, width, height, exaresult.wrong++;mismatchMask[pixel] = 1;if (exact) {- classifyExactMismatch(result, mismatchMask, { pixels, pixel, width, world, cast, keyByColour });+ classifyExactMismatch(result, mismatchMask, { pixels, pixel, width, world, cast, keyByColour, expected: reference });continue;}for (let slot = 0; slot < RIVALS_PER_PIXEL; slot++) {@@ -244,5 +255,5 @@ export function compareWithGroundTruth({ pixels, world, cast, width, height, exa}}}- return { ...result, flipUpperBound: result.flipped + result.offRayInterior, mismatchMask };+ return { ...result, flipUpperBound: result.flipped + result.offRayUnexplained, mismatchMask };}diff --git a/bench/flicker/results/README.md b/bench/flicker/results/README.mdindex 85bcb036..76bf4bba 100644--- a/bench/flicker/results/README.md+++ b/bench/flicker/results/README.md@@ -11,3 +11,12 @@ Summed over the 12 spots: 8 true visibility flips (`flipped`) with the flush paspixels on a triangle edge, where the ray cast and the rasteriser disagree about the pixel centre, not coplanar fights. `offRay` (pixelsshowing a face the pixel-centre ray misses) is the rasteriser and the ray cast differing at edges and is not depth fighting. A renderpass (albedo, object ID) cannot stand in for this: its target has a 24-bit depth buffer, which fights far more than the beauty path.++`melbourne-drape-offray-1280x720.json` is the same exact run with `offRay` taken apart, at `hits=6` and `hits=32` (hits kept per ray in the+ray cast) with the flush pass on, and `hits=6` with it off. Summed over the 12 spots, flush pass on: `offRay` is 18,590 at both hit+counts, so no pixel hides in a stack deeper than 6 faces. It is not edge-only: 363 touch an owner change of the cast in their 3x3+neighbourhood (`offRayEdge`), 18,227 do not (`offRayInterior`). But the colour shown there is within 16 bytes of the colour expected+for 18,367 of the 18,590 (`offRayNearColour` 8,261 within 2, `offRaySmallGap` 10,106 within 3 to 16): consecutive triangle numbers are+consecutive colours, so a rounding step of the frame names an unrelated triangle. Only 215 interior pixels are further off+(`offRayUnexplained`), so the true flips are at most `flipUpperBound` = 8 + 215 = 223 of 5.9 million contested pixels. With the+flush pass off the same bound is 129,361. Reproduce with `probe.mjs --configs "reversed=1,facets=2,shadows=0,hits=6;reversed=1,facets=2,shadows=0,hits=32;reversed=1,facets=2,shadows=0,offset=0,hits=6"`.diff --git a/bench/flicker/results/melbourne-drape-offray-1280x720.json b/bench/flicker/results/melbourne-drape-offray-1280x720.jsonnew file mode 100644index 00000000..ad3f93c4--- /dev/null+++ b/bench/flicker/results/melbourne-drape-offray-1280x720.json@@ -0,0 +1,686 @@+[+ {+ "spot": "roofs",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1052,+ "offRayEdge": 15,+ "offRayInterior": 1037,+ "offRayNearColour": 443,+ "offRaySmallGap": 587,+ "offRayUnexplained": 21,+ "blended": 1,+ "flipUpperBound": 21,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "bridge",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 502,+ "offRayEdge": 3,+ "offRayInterior": 499,+ "offRayNearColour": 250,+ "offRaySmallGap": 227,+ "offRayUnexplained": 25,+ "blended": 0,+ "flipUpperBound": 25,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "river",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1593,+ "offRayEdge": 6,+ "offRayInterior": 1587,+ "offRayNearColour": 467,+ "offRaySmallGap": 1110,+ "offRayUnexplained": 16,+ "blended": 1,+ "flipUpperBound": 16,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "overview",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 568,+ "offRayEdge": 34,+ "offRayInterior": 534,+ "offRayNearColour": 237,+ "offRaySmallGap": 315,+ "offRayUnexplained": 16,+ "blended": 0,+ "flipUpperBound": 16,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass0",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 2441,+ "offRayEdge": 48,+ "offRayInterior": 2393,+ "offRayNearColour": 1155,+ "offRaySmallGap": 1265,+ "offRayUnexplained": 20,+ "blended": 0,+ "flipUpperBound": 20,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass1",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 16,+ "offRay": 2233,+ "offRayEdge": 27,+ "offRayInterior": 2206,+ "offRayNearColour": 783,+ "offRaySmallGap": 1408,+ "offRayUnexplained": 40,+ "blended": 1,+ "flipUpperBound": 40,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass2",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1982,+ "offRayEdge": 49,+ "offRayInterior": 1933,+ "offRayNearColour": 989,+ "offRaySmallGap": 973,+ "offRayUnexplained": 17,+ "blended": 0,+ "flipUpperBound": 17,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass3",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1039,+ "offRayEdge": 26,+ "offRayInterior": 1013,+ "offRayNearColour": 494,+ "offRaySmallGap": 542,+ "offRayUnexplained": 3,+ "blended": 0,+ "flipUpperBound": 3,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass4",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 1,+ "ranked": 0,+ "swapped": 1,+ "tied": 0,+ "offRay": 2920,+ "offRayEdge": 79,+ "offRayInterior": 2841,+ "offRayNearColour": 1537,+ "offRaySmallGap": 1358,+ "offRayUnexplained": 25,+ "blended": 0,+ "flipUpperBound": 26,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass5",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 206,+ "offRay": 2156,+ "offRayEdge": 57,+ "offRayInterior": 2099,+ "offRayNearColour": 1151,+ "offRaySmallGap": 978,+ "offRayUnexplained": 26,+ "blended": 0,+ "flipUpperBound": 26,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass6",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 633,+ "offRayEdge": 8,+ "offRayInterior": 625,+ "offRayNearColour": 304,+ "offRaySmallGap": 326,+ "offRayUnexplained": 3,+ "blended": 0,+ "flipUpperBound": 3,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass7",+ "flushPass": true,+ "hitsPerPixel": 6,+ "flipped": 7,+ "ranked": 0,+ "swapped": 7,+ "tied": 0,+ "offRay": 1471,+ "offRayEdge": 11,+ "offRayInterior": 1460,+ "offRayNearColour": 451,+ "offRaySmallGap": 1017,+ "offRayUnexplained": 3,+ "blended": 1,+ "flipUpperBound": 10,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "roofs",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1052,+ "offRayEdge": 15,+ "offRayInterior": 1037,+ "offRayNearColour": 443,+ "offRaySmallGap": 587,+ "offRayUnexplained": 21,+ "blended": 1,+ "flipUpperBound": 21,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "bridge",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 502,+ "offRayEdge": 3,+ "offRayInterior": 499,+ "offRayNearColour": 250,+ "offRaySmallGap": 227,+ "offRayUnexplained": 25,+ "blended": 0,+ "flipUpperBound": 25,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "river",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1593,+ "offRayEdge": 6,+ "offRayInterior": 1587,+ "offRayNearColour": 467,+ "offRaySmallGap": 1110,+ "offRayUnexplained": 16,+ "blended": 1,+ "flipUpperBound": 16,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "overview",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 568,+ "offRayEdge": 34,+ "offRayInterior": 534,+ "offRayNearColour": 237,+ "offRaySmallGap": 315,+ "offRayUnexplained": 16,+ "blended": 0,+ "flipUpperBound": 16,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass0",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 2441,+ "offRayEdge": 48,+ "offRayInterior": 2393,+ "offRayNearColour": 1155,+ "offRaySmallGap": 1265,+ "offRayUnexplained": 20,+ "blended": 0,+ "flipUpperBound": 20,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass1",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 16,+ "offRay": 2233,+ "offRayEdge": 27,+ "offRayInterior": 2206,+ "offRayNearColour": 783,+ "offRaySmallGap": 1408,+ "offRayUnexplained": 40,+ "blended": 1,+ "flipUpperBound": 40,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass2",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1982,+ "offRayEdge": 49,+ "offRayInterior": 1933,+ "offRayNearColour": 989,+ "offRaySmallGap": 973,+ "offRayUnexplained": 17,+ "blended": 0,+ "flipUpperBound": 17,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass3",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 1039,+ "offRayEdge": 26,+ "offRayInterior": 1013,+ "offRayNearColour": 494,+ "offRaySmallGap": 542,+ "offRayUnexplained": 3,+ "blended": 0,+ "flipUpperBound": 3,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass4",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 1,+ "ranked": 0,+ "swapped": 1,+ "tied": 0,+ "offRay": 2920,+ "offRayEdge": 79,+ "offRayInterior": 2841,+ "offRayNearColour": 1537,+ "offRaySmallGap": 1358,+ "offRayUnexplained": 25,+ "blended": 0,+ "flipUpperBound": 26,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass5",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 206,+ "offRay": 2156,+ "offRayEdge": 57,+ "offRayInterior": 2099,+ "offRayNearColour": 1151,+ "offRaySmallGap": 978,+ "offRayUnexplained": 26,+ "blended": 0,+ "flipUpperBound": 26,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass6",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 0,+ "ranked": 0,+ "swapped": 0,+ "tied": 0,+ "offRay": 633,+ "offRayEdge": 8,+ "offRayInterior": 625,+ "offRayNearColour": 304,+ "offRaySmallGap": 326,+ "offRayUnexplained": 3,+ "blended": 0,+ "flipUpperBound": 3,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass7",+ "flushPass": true,+ "hitsPerPixel": 32,+ "flipped": 7,+ "ranked": 0,+ "swapped": 7,+ "tied": 0,+ "offRay": 1471,+ "offRayEdge": 11,+ "offRayInterior": 1460,+ "offRayNearColour": 451,+ "offRaySmallGap": 1017,+ "offRayUnexplained": 3,+ "blended": 1,+ "flipUpperBound": 10,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "roofs",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 11329,+ "ranked": 0,+ "swapped": 11329,+ "tied": 1114,+ "offRay": 4982,+ "offRayEdge": 0,+ "offRayInterior": 4982,+ "offRayNearColour": 470,+ "offRaySmallGap": 638,+ "offRayUnexplained": 3874,+ "blended": 1,+ "flipUpperBound": 15203,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "bridge",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 3271,+ "ranked": 0,+ "swapped": 3271,+ "tied": 0,+ "offRay": 1030,+ "offRayEdge": 0,+ "offRayInterior": 1030,+ "offRayNearColour": 250,+ "offRaySmallGap": 307,+ "offRayUnexplained": 473,+ "blended": 0,+ "flipUpperBound": 3744,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "river",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 1973,+ "ranked": 0,+ "swapped": 1973,+ "tied": 133,+ "offRay": 2906,+ "offRayEdge": 0,+ "offRayInterior": 2906,+ "offRayNearColour": 471,+ "offRaySmallGap": 1465,+ "offRayUnexplained": 970,+ "blended": 1,+ "flipUpperBound": 2943,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "overview",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 54,+ "ranked": 0,+ "swapped": 54,+ "tied": 44,+ "offRay": 659,+ "offRayEdge": 0,+ "offRayInterior": 659,+ "offRayNearColour": 234,+ "offRaySmallGap": 345,+ "offRayUnexplained": 80,+ "blended": 0,+ "flipUpperBound": 134,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass0",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 23328,+ "ranked": 0,+ "swapped": 23328,+ "tied": 119,+ "offRay": 5211,+ "offRayEdge": 0,+ "offRayInterior": 5211,+ "offRayNearColour": 1404,+ "offRaySmallGap": 1999,+ "offRayUnexplained": 1808,+ "blended": 0,+ "flipUpperBound": 25136,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass1",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 1371,+ "ranked": 0,+ "swapped": 1371,+ "tied": 16,+ "offRay": 2905,+ "offRayEdge": 0,+ "offRayInterior": 2905,+ "offRayNearColour": 898,+ "offRaySmallGap": 1655,+ "offRayUnexplained": 352,+ "blended": 1,+ "flipUpperBound": 1723,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass2",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 42069,+ "ranked": 0,+ "swapped": 42069,+ "tied": 2477,+ "offRay": 6704,+ "offRayEdge": 0,+ "offRayInterior": 6704,+ "offRayNearColour": 838,+ "offRaySmallGap": 1551,+ "offRayUnexplained": 4315,+ "blended": 0,+ "flipUpperBound": 46384,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass3",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 6376,+ "ranked": 0,+ "swapped": 6376,+ "tied": 128,+ "offRay": 5763,+ "offRayEdge": 0,+ "offRayInterior": 5763,+ "offRayNearColour": 451,+ "offRaySmallGap": 987,+ "offRayUnexplained": 4325,+ "blended": 0,+ "flipUpperBound": 10701,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass4",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 5141,+ "ranked": 0,+ "swapped": 5141,+ "tied": 236,+ "offRay": 4179,+ "offRayEdge": 0,+ "offRayInterior": 4179,+ "offRayNearColour": 1540,+ "offRaySmallGap": 1660,+ "offRayUnexplained": 979,+ "blended": 0,+ "flipUpperBound": 6120,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass5",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 1586,+ "ranked": 0,+ "swapped": 1586,+ "tied": 318,+ "offRay": 3215,+ "offRayEdge": 0,+ "offRayInterior": 3215,+ "offRayNearColour": 1192,+ "offRaySmallGap": 1256,+ "offRayUnexplained": 767,+ "blended": 0,+ "flipUpperBound": 2353,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass6",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 212,+ "ranked": 0,+ "swapped": 212,+ "tied": 0,+ "offRay": 668,+ "offRayEdge": 0,+ "offRayInterior": 668,+ "offRayNearColour": 306,+ "offRaySmallGap": 325,+ "offRayUnexplained": 37,+ "blended": 0,+ "flipUpperBound": 249,+ "width": 1280,+ "height": 720+ },+ {+ "spot": "glass7",+ "flushPass": false,+ "hitsPerPixel": 6,+ "flipped": 12812,+ "ranked": 0,+ "swapped": 12812,+ "tied": 0,+ "offRay": 4367,+ "offRayEdge": 0,+ "offRayInterior": 4367,+ "offRayNearColour": 682,+ "offRaySmallGap": 1826,+ "offRayUnexplained": 1859,+ "blended": 1,+ "flipUpperBound": 14671,+ "width": 1280,+ "height": 720+ }+]diff --git a/changes/751-offray-edges.md b/changes/751-offray-edges.mdindex 1722f030..996ac6db 100644--- a/changes/751-offray-edges.md+++ b/changes/751-offray-edges.md@@ -1 +1 @@-- The flicker probe splits offRay pixels into edge and interior ones, reports an upper bound of true flips, and keeps a configurable number of ray hits (#751)+- The flicker probe splits offRay pixels into edge, colour-step and unexplained ones, reports an upper bound of true flips, and keeps a configurable number of ray hits (#751)diff --git a/tests/flicker-ground-truth.test.js b/tests/flicker-ground-truth.test.jsindex 58bcf6c8..41a8d18f 100644--- a/tests/flicker-ground-truth.test.js+++ b/tests/flicker-ground-truth.test.js@@ -263,6 +263,7 @@ test('an exact frame showing a face off the ray, or a colour no face has, is notassert.equal(outcome.offRay, 1);assert.equal(outcome.offRayEdge, 1, 'the middle of the plaque sits on its diagonal, a seam of the ray cast');assert.equal(outcome.offRayInterior, 0);+ assert.equal(outcome.offRayUnexplained, 0);assert.equal(outcome.flipUpperBound, 0);assert.equal(outcome.blended, 1);assert.equal(outcome.swapped, 0);@@ -281,9 +282,22 @@ test('an offRay pixel on a triangle edge of the ray cast is split off from one iassert.equal(outcome.offRay, 2);assert.equal(outcome.offRayEdge, 1);assert.equal(outcome.offRayInterior, 1);+ assert.equal(outcome.offRayUnexplained, 1);assert.equal(outcome.flipUpperBound, 1);});+test('an offRay pixel a few bytes from the colour expected is a rounding step of the frame, not an upper-bound flip', () => {+ const parts = [...wallWithPlaque(0.01), wallPart('neighbour-colour', 2, 2, 0, [0, 0, 0.99])];+ parts[2].matrix = new Float32Array([...IDENTITY.slice(0, 12), 500, 0, 0, 1]);+ const world = collectWorldTriangles(parts, () => null);+ const cast = castPixelOwners(world, CAMERA, WIDTH, HEIGHT);+ const outcome = compareExact(paintExactFrame(cast, pixel => (pixel === CENTRE + 4 ? [0, 0, 252] : null)), world, cast);+ assert.equal(outcome.offRayInterior, 1);+ assert.equal(outcome.offRaySmallGap, 1);+ assert.equal(outcome.offRayUnexplained, 0);+ assert.equal(outcome.flipUpperBound, 0);+});+// A wall under seven more faces, each 1 cm in front of the last: the wall is the eighth hit of every ray through the middle.function deepStack() {const parts = [wallPart('wall', 12, 12, 0, RED)];