Vixen
dd8b0a81
csharp
public sealed class QueriedField

The hardware tracer's answers, written first and device-free — doc 19 § L6's referee for RayQueryField.rvn.

Read the guide page for this →

Remarks

One class answering exactly what the shader answers, the arrangement every dispatch comparison here leans on: where the kernel opens a ray query against the two-level structure, this asks the TriangleBvh built from the same triangles — the traversal already held hit-for-hit against brute force — so a device disagreement is the device's, not the fixture's.

An acceleration structure holds surfaces, not distances, and the honest answers follow from that. The trace and the shadow are queries and exact. The point questions are not askable: SampleField answers "nothing is near" — the same Nothing NoDistanceField answers, a step any march may safely take — and GradientField(Vector3) answers the up vector, which is NoDistanceField's answer too.

⚠ A hit is a different question, and this is where its reference now lands. A hit's true surface normal is the committed triangle's, and Normal carries it beside the Primitive a shader would have to read the vertex buffer with — the two things RayQueryField.rvn discards one line after the intrinsic answers them. GradientField is the overload the shared protocol has to grow, expressed here first because here it can be checked. #1169's device half — a field on DistanceFieldHit, every IDistanceFieldSource filling it, and the vertex and index buffers bound beside sceneStructure — is still owed, and lands in the one place nothing in this repository can referee.

Fields and properties (1)

  • public const float Nothing

    What the point questions answer — further than any march goes, by value the library's NoDistanceField.Nothing.

Methods (7)

  • public QueriedField(TriangleBvh bvh)

    Wraps the hierarchy the queries walk.

  • public static float SampleField(Vector3 world)

    The signed distance at a world position — "nothing is near", always.

  • public static Vector3 GradientField(Vector3 world)

    The distance gradient at a world position — the up vector, always.

  • public static Vector3 GradientField(in QueriedHit hit)

    The surface normal at a hit, which is the question a position cannot answer.

  • public QueriedHit TraceField(Vector3 origin, Vector3 direction, float maxDistance)

    The trace, answered with a query: the nearest triangle within the budget.

  • public float ShadowField(Vector3 origin, Vector3 toLight, float lightDistance, float bias)

    How much of a light reaches a point: one or zero, from one query.

  • public static float OcclusionField(Vector3 position, Vector3 normal)

    How enclosed a point is — fully open, always: enclosure is a distance question.

Used by (2)

  • AccelerationStructureDeviceTestsVixen.Graphics.Golden.Tests
  • QueriedFieldTestsVixen.Rendering.RayTracing.Tests