Skip to content

Ray Tracer Driver

The RayTracer driver performs deterministic ray tracing through volumetric data, supporting projections, volume rendering, and line-of-sight tracing operations.

Overview

Unlike the Monte Carlo Radiative Transfer (MCRT) driver which simulates stochastic photon transport, the RayTracer follows deterministic ray paths through the simulation domain. This makes it ideal for:

  • Projections: Column density maps, temperature-weighted projections
  • Volume rendering: 3D visualization with transfer functions
  • Line tracers: Extracting quantities along specific sight lines

Architecture

flowchart TD
    subgraph RayTracer["RayTracer Driver"]
        init[Initialize] --> run[run]
        run --> proj[run_projections]
        run --> trace[run_tracers]
        run --> abs[run_absorptiongrids]
    end

    subgraph Operators["Operators"]
        proj --> ProjOp[ProjectionOperator]
        proj --> VolOp[VolumeRenderOperator]
        trace --> TracerOp[TracerOperator]
        abs --> AbsOp[OpticalDepthGridOperator]
    end

    subgraph Kernel["SYCL Kernel"]
        ProjOp --> kernel[evolve_step]
        VolOp --> kernel
        TracerOp --> kernel
        AbsOp --> kernel
        kernel --> field[Field Access]
    end

    field --> smart[SmartFieldAccessor]
    field --> dynamic[DynamicFieldAccessor]

Operators

ProjectionOperator

Computes 2D projections by integrating field values along rays:

\[ P(x,y) = \int_0^L q(s) \cdot w(s) \, ds \]

Where:

  • \(q(s)\) is the quantity being projected (e.g., Temperature)
  • \(w(s)\) is the weight field (typically Density)
  • \(L\) is the path length through the domain

Configuration example:

raytracer:
  operators:
    projections:
      mode: manual
      position: [0.5, 0.5, 0.0]
      direction: [0.0, 0.0, 1.0]
      up: [0.0, 1.0, 0.0]
      npixels: [512, 512]
      widths: [1.0, 1.0]
      fields:
        - Temperature
        - Density

VolumeRenderOperator

Performs volume rendering with density-weighted field values for 3D visualization.

TracerOperator

Traces rays and records field values at each cell traversal, producing per-ray profiles.

Camera Modes

The RayTracer supports several camera modes for generating ray origins and directions:

Mode Description
manual Explicit position, direction, and up vectors
rotate Rotate camera around a center point
traverse Move camera along a trajectory
banana Curved path for specific viewing geometries

Field Access

The RayTracer uses runtime field selection, allowing the quantity to project to be specified at runtime rather than compile time. See JIT Field Access for implementation details.

Output

Results are saved as HDF5 datasets:

  • Projections: 2D arrays with shape (npixels_y, npixels_x)
  • Volume renders: RGB(A) images
  • Tracers: Per-ray field profiles

Performance Considerations

  • Use Release builds for production runs (10-100x faster than Debug)
  • The number of rays equals npixels_x * npixels_y
  • Memory scales with ray count and maximum path length