Repository navigation
fix: Keep one non-finite value from corrupting its compressed PLY chunk - #355
rudycelekli wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for this. The NaN-poisons-the-whole-chunk bug is real and worth fixing, but the change as written introduces a regression for
So a chunk of entirely flat splats becomes unit-thickness slabs, which is worse than the original bug because it affects clean input. Could you:
Minor: with this change a NaN-position splat decodes to the chunk's min corner with its own color/opacity, i.e. a visible stray splat rather than one the renderer drops. Still better than losing 256 splats, but the description's comparison to plain PLY isn't quite accurate; |
Problem
In compressed PLY output,
CompressedChunk.pack()computes each 256-splat chunk's min/max withMath.min/Math.max. A single NaN in a chunk's position, scale or color makes the bounds NaN, so all 256 splats in the chunk decode as NaN (a plain PLY would lose only the one bad splat). Related symptom class: playcanvas/supersplat#494 and playcanvas/supersplat#356 (chunk bounds degrading splats). I could not reproduce those two issues themselves with synthetic data; this is a separate, provable robustness defect in the same code.Evidence (synthetic 256-splat table, one NaN each in
x,scale_0,f_dc_1, round-tripped throughwriteCompressedPly+readPly)x: 256 NaN values after round-trip(same for the other two columns)Change
calcMinMaxignores non-finite values (falls back to 0..0 if none are finite).normalizemaps NaN to 0.Verified / not verified
test/formats.test.mjsfails before the change and passes after;npm run lint,tsc --noEmit, andtest/formats.test.mjs,write-sog,process,quantize-1dtests pass. I did not run the GPU/render tests.I reviewed and tested it before opening.