RayHit

template<IsSpectral TSpectral>
struct Interaction

Surface interaction information for rendering.

Stores geometric and shading information at a surface intersection point, including position, normals, tangent frame, texture coordinates, interpolated vertex albedo, and outgoing direction. Used in BSDF evaluation, texture lookup, and light transport calculations.

Template Parameters:

TSpectral – Spectral type for the rendering pipeline

Public Members

Vec3<float> position

Intersection point in world space.

Vec3<float> normal_g

Geometric normal at the intersection.

Vec3<float> normal_s

Shading normal at the intersection.

Vec3<float> tangent

Tangent vector (for normal mapping / anisotropic BSDFs)

Vec3<float> bitangent

Bitangent vector (cross(normal_s, tangent))

Vec2<float> uv

Texture coordinates (u, v)

Vec3<float> wo

Outgoing direction (towards camera), world space.

TSpectral vertex_albedo = {1}

Interpolated vertex color (default: white / unity)

template<IsFloatingPoint T>
inline Vec3<T> huira::offset_intersection_(Vec3<T> intersection, const Vec3<T> &N)

Offsets an intersection point along a normal to prevent self-intersection artifacts.

Uses bit-level manipulation to offset the intersection point in floating-point or integer space, depending on the magnitude, to avoid shadow acne and other precision issues in ray tracing. Adapted from Section 6.2.2.4 of “Physically Based Rendering” (Springer).

Template Parameters:

T – Floating-point type

Parameters:
  • intersection – The intersection point

  • N – The geometric normal at the intersection

Returns:

Vec3<T> Offset intersection point