Scene View¶
-
template<IsSpectral TSpectral>
class SceneView¶ View of a scene at a specific time and camera instance.
SceneView collects geometry, lights, unresolved objects, and stars for rendering.
- Template Parameters:
TSpectral – Spectral type (e.g., RGB, Spectral)
Public Functions
-
SceneView(const Scene<TSpectral> &scene, const Interval &exposure_interval, const InstanceHandle<TSpectral> &camera_instance, ObservationMode obs_mode, std::size_t num_temporal_samples = 1)¶
Construct a SceneView for a given scene, time, camera, and observation mode.
Collects geometry, lights, unresolved objects, and stars for rendering.
- Parameters:
scene – Scene to view
exposure_interval – Exposure interval
camera_instance – Camera instance handle
obs_mode – Observation mode
num_temporal_samples – Number of temporal samples for motion blur (default: 1)
-
HitRecord intersect(const Ray<TSpectral> &ray, float time = 0.5f, unsigned int mask = 0xFFFFFFFF) const¶
Intersect a ray with the scene and return the hit record.
- Parameters:
ray – The ray to intersect.
time – The time for motion blur.
- Returns:
The hit record.
-
TSpectral evaluate_transmittance(const Ray<TSpectral> &shadow_ray, float t_far, const MediumStack<TSpectral> &initial_stack, RandomSampler<float> &sampler, float time = 0.5f) const¶
Evaluate transmission along a ray.
- Parameters:
ray – The ray to intersect.
time – The time for motion blur.
- Returns:
The spectral transmission
-
Interaction<TSpectral> resolve_hit(const Ray<TSpectral> &ray, const HitRecord &hit) const¶
Resolve a hit record into a full interaction, including position, normals, UVs, etc.
- Parameters:
ray – The ray that caused the hit.
hit – The hit record to resolve.
- Returns:
The resolved interaction.
-
std::vector<HitRecord> intersect(const std::vector<Ray<TSpectral>> &rays, float time = 0.5f) const¶
Intersect a batch of rays with the scene and return their hit records.
- Parameters:
rays – The rays to intersect.
time – The time for motion blur.
- Returns:
A vector of hit records corresponding to each ray.
-
std::vector<Interaction<TSpectral>> resolve_hits(const std::vector<Ray<TSpectral>> &rays, const std::vector<HitRecord> &hits) const¶
Resolve a batch of hit records into full interactions.
- Parameters:
rays – The rays that caused the hits.
hits – The hit records to resolve.
- Returns:
A vector of resolved interactions.
-
inline const std::vector<LightInstance<TSpectral>> &lights() const¶
The light instances collected for this view.
-
inline const std::vector<IndirectSourceInstance<TSpectral>> &indirect_sources() const¶
The designated indirect illumination sources collected for this view.
-
std::size_t indirect_source_index(const HitRecord &hit) const¶
Returns the indirect-source index of the instance a hit landed on.
- Parameters:
hit – The hit record to classify.
- Returns:
Index into indirect_sources(), or NO_INDIRECT_SOURCE if the hit is invalid or not on a designated indirect source.
-
TSpectral direct_lit_radiance(const Ray<TSpectral> &ray, const HitRecord &hit, RandomSampler<float> &sampler, float time = 0.5f, const MediumStack<TSpectral> &medium_stack = MediumStack<TSpectral>{}) const¶
Evaluates the direct (next-event-estimated) radiance leaving a hit point.
Resolves the hit, evaluates its material, and accumulates the MIS-weighted contribution of every light in the view toward the hit point, returning the outgoing radiance along -ray.direction(). Only primitive (non-light) geometry is shaded; hits on light geometry return zero, as emission is the caller’s responsibility. Partial opacity at the hit point is not resampled here.
- Parameters:
ray – The ray that produced the hit.
hit – The hit record (must reference primitive geometry to shade).
sampler – Random sampler for light sampling and transmittance estimation.
time – Normalized time in [0, 1] for motion blur.
medium_stack – The medium stack at the hit point (defaults to empty).
- Returns:
The direct-lit outgoing spectral radiance at the hit.
-
inline units::Second duration() const¶
Public Static Attributes
-
static std::size_t NO_INDIRECT_SOURCE = std::numeric_limits<std::size_t>::max()¶
Sentinel returned by indirect_source_index() for hits that are not on a designated indirect source.