RayHit

template<IsSpectral TSpectral>
struct Interaction

Surface interaction information for rendering.

Stores geometric and shading information at a surface intersection point, including position, normals, barycentric coordinates, and outgoing direction. Used in rendering calculations for lighting, shading, and visibility.

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> uvw

Barycentric coordinates (u, v, w)

Vec3<float> wo

Outgoing direction (towards camera)

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.

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

  • T – Floating-point type

Parameters:
  • intersection – The intersection point

  • N – The geometric normal at the intersection

  • intersection – The intersection point

  • N – The geometric normal at the intersection

Returns:

Vec3<T> Offset intersection point

Returns:

Vec3<T> Offset intersection point