public static class ClusterAttributesRecovering a pixel's attributes from the triangle it landed on — phase 5's reconstruction, and the definition both the resolve and its tests are held against.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Phase 5 of docs/plan/22-virtualized-geometry.md. A visibility buffer stores which triangle covered a pixel and nothing else, so everything an interpolator would have handed the fragment stage — the world position, the normal, the texture coordinate, and the rate at which the coordinate changes — has to be worked out again from the triangle's three corners and the pixel's own position.
The mirror exists because two of the three steps fail silently. Solving the weights in screen space and using them directly is the classic affine-texturing error: the image is plausible, straight lines bend, and a texture swims across a floor as the camera moves. Correcting the weights but not their derivatives is subtler still — the picture is then right and only the mip selection is wrong, which reads as a texture that is slightly too sharp at grazing angles. Neither is a crash and neither is visible in a still. Improvement 4 of the plan is exactly this argument.
Analytic, not from a quad. A resolve dispatched over tiles has no quad to take derivatives against — and even a fragment-stage resolve, which does, would be taking them across a neighbour that may belong to a different triangle of a different cluster. That is wrong precisely at the silhouettes where it is most visible, which is why the plan says the gradients come from the triangle plane rather than from ddx.
Fields and properties (1)
public const float EpsilonBelow which the solve's reciprocal is not finite enough to use.
Methods (8)
public static Barycentrics Of(Vector2 pixel, Vector4 clip0, Vector4 clip1, Vector4 clip2, Vector2 pixelSize)A pixel's barycentric weights on a triangle whose corners are in clip space.
public static float Lerp(in Barycentrics b, float a0, float a1, float a2)One scalar attribute, interpolated.
public static Vector2 Lerp(in Barycentrics b, Vector2 a0, Vector2 a1, Vector2 a2)A two-component attribute, interpolated.
public static Vector3 Lerp(in Barycentrics b, Vector3 a0, Vector3 a1, Vector3 a2)A three-component attribute, interpolated.
public static Vector4 Lerp(in Barycentrics b, Vector4 a0, Vector4 a1, Vector4 a2)A four-component attribute, interpolated.
public static Vector2 Ddx(in Barycentrics b, Vector2 a0, Vector2 a1, Vector2 a2)How a two-component attribute changes across one pixel in x.
public static Vector2 Ddy(in Barycentrics b, Vector2 a0, Vector2 a1, Vector2 a2)How it changes across one pixel in y.
public static Vector2 PixelSize(Int2 size)How much of NDC one pixel spans, for a view of a size.
Used by (1)
- ClusterAttributeTestsVixen.Rendering.Tests