public readonly record struct QueriedHitOne answer of a QueriedField trace — DistanceFieldHit, by shape.
Remarks
⚠ The last two are what RayQueryField.rvn throws away one line after the intrinsic answers them, and this is the reference half of #1169. A hardware Trace answers (t, primitive, instance, hit); the shader keeps t, builds a DistanceFieldHit that has nowhere to put the rest, and every consumer then asks GradientField(hit.position) — a position, which names no triangle. So the honest answer there is the up vector, and SurfaceRadiance(position, normal) picks a card by normal: a constant upward answer picks every horizontal card in the atlas whatever the surface is, which reads as the surface cache being wrong rather than as a normal bug.
⚠ And the CPU half turned out to be smaller than #1169 describes. The issue says "the CPU pair can compute the geometric normal from the same triangle the BVH committed"; Trace already computes it, already faces it at the ray, and already returns the triangle index beside it — QueriedField was discarding both while constructing this. Nothing was computed here; two fields were carried.
Both, rather than only the normal the consumers want. The index is the mechanism the device half has to use — a shader has no cross product to fall back on and must read the vertex buffer the structure was built from — so a referee that carries only the answer cannot referee the step that produces it.
Fields and properties (6)
public bool HitWhether the query committed a triangle.
public float DistanceHow far along the ray it stands, or the budget for a miss.
public Vector3 PositionWhere — on the triangle, or at the budget's end.
public int StepsOne. A query is one step, and the field's tracers report their cost, so this reports its.
public Vector3 NormalThe committed triangle's geometric normal, facing the ray, or the up vector for a miss.
public int PrimitiveWhich triangle the query committed, as an index into the build's list, or −1 for a miss.
Methods (1)
Used by (3)
- AccelerationStructureDeviceTestsVixen.Graphics.Golden.Tests
- QueriedFieldVixen.Rendering.RayTracing
- QueriedFieldTestsVixen.Rendering.RayTracing.Tests