Renderer

template<IsSpectral TSpectral>
class Renderer

Abstract base class for scene renderers.

Renderer provides the interface and common helpers for rendering a SceneView into a FrameBuffer. Derived classes implement specific rendering algorithms.

Template Parameters:

TSpectral – Spectral type for the rendering pipeline

Public Functions

virtual ~Renderer() = default
virtual void render(SceneView<TSpectral> &scene_view, FrameBuffer<TSpectral> &frame_buffer)
inline void set_samples_per_pixel(int spp)
inline void set_max_bounces(int max_bounces)
inline void set_dynamic_sampling(bool dynamic_sampling = true)
inline void set_min_samples(int min_samples)
inline void set_variance_threshold(float threshold)
inline void set_indirect_clamp(float indirect_clamp)

Protected Functions

virtual Image<TSpectral> path_trace_(SceneView<TSpectral> &scene_view, FrameBuffer<TSpectral> &frame_buffer)

Path trace a scene view into a frame buffer.

Traces camera rays through each pixel, evaluating direct lighting with shadow rays and indirect illumination via recursive path tracing with Russian roulette termination.

The rendering is parallelized over tiles using TBB. Each tile accumulates results from multiple samples per pixel (spp_) into the frame buffer.

Template Parameters:

TSpectral – Spectral type for the rendering pipeline

Parameters:
  • scene_view – The scene view containing geometry, lights, and environment

  • frame_buffer – The frame buffer to render into

virtual Image<TSpectral> render_unresolved_(SceneView<TSpectral> &scene_view, FrameBuffer<TSpectral> &frame_buffer)

Render unresolved point sources (stars and unresolved objects) into the frame buffer.

This method implements an optimized pipeline for rendering point sources that cannot be resolved into visible geometry. It supports both delta-function (no PSF) and spatially- distributed PSF rendering with adaptive radius culling for performance.

The rendering pipeline:

  1. Collects all stars and unresolved objects into a unified list

  2. Builds a radius LUT and assigns per-source effective PSF radii based on irradiance

  3. Projects sources to screen space and bins them into tiles

  4. Renders each tile in parallel into local buffers

  5. Combines tile buffers into the final frame buffer

Performance optimizations:

  • Adaptive PSF radius: dim sources use smaller kernels

  • Tiled rendering: parallel processing with minimal synchronization

  • Depth occlusion testing: skip sources behind resolved geometry

Template Parameters:

TSpectral – Spectral type for the rendering pipeline

Parameters:
  • scene_view – The scene view containing stars and unresolved objects

  • frame_buffer – The frame buffer to render into

inline std::shared_ptr<CameraModel<TSpectral>> get_camera(SceneView<TSpectral> &scene_view) const
inline std::vector<MeshBatch<TSpectral>> get_meshes(SceneView<TSpectral> &scene_view) const
inline std::vector<LightInstance<TSpectral>> get_lights(SceneView<TSpectral> &scene_view) const

Protected Attributes

RandomSampler<float> sampler_
int spp_ = 10
int max_bounces_ = 3
bool dynamic_sampling_ = false
int min_spp_ = 16
float variance_threshold_ = 0.001f
float indirect_clamp_threshold_ = std::numeric_limits<float>::infinity()