Keep a grab the deformer cull cannot judge in the brick's tape (#649) - #652
Merged
Merged
Conversation
The per-brick deformer cull (#452) tests each grab's ball against the cull region in the item's local frame, dilating the region by every move a kept link can make. Two cases broke that induction and dropped grabs that do reach the brick, so the brick build disagreed with clay_eval_points: - A repeated item. The interpreter folds the local point into its repetition cell before the chain runs, so a copy away from the source cell samples the grab at points the unfolded region never contains. This was the large half of #649: in-band brick samples off the raw field by up to 0.26 on random documents with a radial or grid repeat. A repeated item now keeps its whole chain. - A grab behind any other point warp. Only a grab's move is bounded, but a kept magnify, twist or pose did not dilate the region, so the grabs after it were tested against the bare region (0.038 off in the regression fixture). The first non-grab link now ends the test and the rest of the chain is kept. A Move's grabs sit at the head of a chain and are still culled. RV_RAWCHECK on undo_bound_oracle_probe: rich sweep 62 -> 35 documents, worst 0.2632 -> 0.0825; plain sweep unchanged at 21 (no repeats there). What remains is the chain cull pad and squashed placements, not the deformer cull.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
#649: a full brick build of a document disagrees with that document's own raw field (
clay_eval_points) at in-band samples, by up to 0.263 on randomrichdocuments. Before changing anything I reproduced it on origin/main (8b7a571) with the issue's probe: seeds 933, 5111 and 6043 give the numbers the issue lists (125 / 1,219 / 216 samples, worst 0.0105 / 0.1894 / 0.2632).To tell the causes apart I compiled the brick tape without a cull region, and then shrank each failing document and compared the culled tape with the whole-document tape at the bad samples. Three separate mechanisms show up. This PR fixes the one that produces the large errors, the deformer cull. It also fixes a second hole in that same function that the investigation found. The other two mechanisms are reported below and are not changed here.
The cause fixed here: the deformer cull (#452) dropped grabs that reach the brick
Compiler::cull_deformerstests each grab's ball against the cull region in the item's local frame. Its soundness argument is induction along the chain: the region grows by every move a kept link can make. That argument breaks in two places:ctape_repeat_point, thenctape_prim_local). The chain therefore sees the folded point, while the region test used the unfolded one. A brick over any copy except the source cell dropped the grab, so that copy was filled undeformed. All of 5111's and 6043's error has this cause: each shrinks to one item with a radial or finite-grid repeat and one grab.What lands
cull_deformerstakes the item'sRepeat. A repeated item keeps its whole chain.Measured (
RV_RAWCHECK=1 undo_bound_oracle_probe)Plain documents carry no repeats, so they do not move. The issue is not closed by this PR. What remains comes from the two mechanisms below, which are not in the deformer cull.
What remains (not changed here)
A. The chain cull pad is below one blend's support. Seed 978 shrinks to two boxes: a hard Add, then a quadratic smooth Add with k = 0.262. The pad is
k * envelope(N) = 2.80k = 0.735, but one blend moves the result wherevera < b + 4k. The error at the brick is 0.0039, and the unshrunk document reaches 0.031. For a two-item chain the support (4k), the pad before #335, is exactly sufficient. Below it the error can reach about 0.1k. The #335 envelope was measured only at N >= 75 and applies its N = 75 value to every smaller layer. Forcing the pad to the support leaves 2 plain and 7 rich documents, and those come from longer chains (a fixed pad was never a proof there) plus B. The scene-model spec makes the envelope evidence-bound and its bar relative ("equal-or-fewer disagreements than the pre-envelope pad"). These documents break that bar, so how to repair it is a decision about the pad versus the #335 perf win. It belongs in its own change.B. Squashed placements are culled as if their field were a distance. Seeds 5743 and 6290 shrink to items or layers with a non-uniform per-axis scale.
cscale_nu_distunderstates the distance by up to max(s)/min(s), asscene/types.hsays. The per-brick cull still drops such an item once its box is band + pad away.item_geometry_reach_in_documentalready refuses a squashed placement for this reason. The cull needs the equivalent: dilate by(q - 1) * (band + pad), which in turn needs the band carried inCullRegionand in the cachedCullIndexentries.The forward-Move rows in the issue (seeds 933 and 5229) are A and B, and they do not change here.
Verification
tests/unit/test_deformer_cull.cpp: a radial copy, a grid copy, and a magnify ahead of a grab. All three fail on origin/main (worst 0.0151, 0.12, and 117 unequal samples) and pass with the fix. Each asserts that the grab really moves samples in the region, so none of them can pass because nothing was there to cull.CLAY_BUILD_TESTS=ON).check_layering,check_kernel_dialect,check_licenses,check_c_abi,check_test_shards --binary(2935 cases partitioned) andcheck_doc_latencyall pass.Part of #649.