Files
orisys-sensor-design/docs/xynova-texture-investigation.md
2026-09-19 21:02:34 +08:00

68 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Xynova camera-projected patch investigation
## Intended pattern
The requested squares are defined in the image seen by `cam_sensor`, not in the
flat compute PNG or in physical surface distances. The current 1000×1000 camera
and 80×80 grid define nominal 12.5×12.5 camera-pixel cells. Silhouette and occlusion
boundaries may clip those cells.
Changing PNG width/height or forcing UV shapes to squares is not a correction of
the camera pattern. An independent raycast using Blender loop triangles, a BVH,
and triangle barycentric UV interpolation measured the following centre-region
steps (camera samples (0.5,0.5), (0.5125,0.5), (0.5,0.5125)):
| UV layout | Horizontal step in texture pixels | Vertical step | Ratio |
|---|---:|---:|---:|
| compute | 59.3465 | 50.7074 | 1.17037 |
| produce | 106.1594 | 90.2955 | 1.17569 |
These are local mapped edge lengths, not axis-aligned bounding boxes. They show
that camera-square elements can legitimately look rectangular in the flat UV
artwork. Curved surfaces also make the distortion position-dependent.
## Confirmed interpolation defect
The investigated blend contains 4,818 triangles and 16 quads with no modifiers.
A valid quad does not need to be removed or manually triangulated to be usable.
However, the original `get_uv_from_face()` always selected a polygon's first
three vertices, even for a ray hitting the other tessellated half of a quad. It
also formed barycentric weights from unsigned triangle areas, which are not a
valid containment-aware extrapolation outside that first triangle.
At an actual tessellated triangle centre on compute polygon 4826:
- Correct UV: approximately `(0.0480605, 0.2511341)`.
- Original generator UV: approximately `(-0.0245351, 0.3876915)`.
The error is hundreds of output pixels and can leave the tile. The original
periodic-wrapping heuristic can then relocate the bad polygon into another part
of the texture. Another tested compute polygon (2876) produced a UV error of
approximately 0.1471, mostly in V.
## Separate seam-construction weakness
The original generator connected independently raycast camera-cell corners into
one UV polygon (or their convex hull near the silhouette). That loses the face
and UV-chart identity of each sample. A cell spanning a UV seam cannot generally
be represented by one polygon connecting all its samples. A UV-span threshold
or a final raster mask can hide some symptoms, but neither repairs the mapping
and a raster-only mask leaves incorrect SVG/PDF geometry.
The approved correction uses triangle-local camera-cell intersections, keeps
separate UV fragments across seams, and applies perspective-correct interpolation.
Verification must check the vector fragments against the actual UV triangles and
check their reprojection against the camera grid, not merely inspect the PNG.
## Source preservation baseline
Source: `sensors/finger-xynova/r01/source/geometry.blend`
SHA-256 recorded before implementation:
`574e1e4501db224e025a0b44327afa53726d71a25c36aa8c36d8c45a6f0317b2`
The blend was already modified relative to Git HEAD when this investigation
started. That user modification must be preserved. No camera configuration,
mesh editing, UV re-unwrapping, staging, or commits are part of this repair.