Scene¶
A scene keeps track of the scene elements: sensors, emitters, shapes, materials and media. It also specifies the integrator that should be used to compute the light transport in the scene. Scenes are loaded from a data source.
-
class scene_t
Holds all scene data, and provides emitter and spectral sampling facilities.
Public Functions
-
inline const auto &get_id() const
-
inline const auto &integrator() const
-
inline const auto &sensors() const
-
inline auto &sampler() const noexcept
-
inline const auto &shapes() const
-
inline const auto &emitters() const
-
inline const auto &get_world_aabb() const
-
inline emitter_wavenumber_sample_t sample_emitter_and_spectrum(const sensor::sensor_t *sensor) const noexcept
Given a sensor, samples an emitter from all scene emitters, as well as a wavenumber from the sampled emitter’s spectrum (integrated over the sensor’s spectrum).
- Parameters:
sensor – used sensor
-
inline emitter_beam_wavenumber_sample_t sample_emitter_and_spectrum_and_source_beam(const sensor::sensor_t *sensor) const noexcept
Given a sensor, samples an emitter from all scene emitters, as well as a wavenumber from the sampled emitter’s spectrum (integrated over the sensor’s spectrum), then sources a beam from the sampled emitter. Does NOT divide by the emitter or wavelength sampling density.
- Parameters:
sensor – used sensor
-
inline emitter_direct_sample_t sample_emitter_direct(sampler::sampler_t &sampler, const sensor::sensor_t *sensor, const pqvec3_t &wp, const wavenumber_t k) const noexcept
Samples a direct connection from a world position to a scene emitter for a given sensor. Divides by the sampled emitter’s sampling probability mass. Does NOT divide by the wavelength sampling density.
- Parameters:
sampler – sampler to use (overriding the scene’s sampler)
sensor – used sensor
wp – world position from which direct sampling is applied
k – wavenumber
-
inline emitter_direct_sample_t sample_emitter_direct(const sensor::sensor_t *sensor, const pqvec3_t &wp, const wavenumber_t k) const noexcept
Samples a direct connection from a world position to a scene emitter for a given sensor. Divides by the sampled emitter’s sampling probability mass. Does NOT divide by the wavelength sampling density.
- Parameters:
sensor – used sensor
wp – world position from which direct sampling is applied
k – wavenumber
-
inline emitter_direct_sample_pdf_t pdf_emitter_direct(const sensor::sensor_t *sensor, const emitter::emitter_t *emitter, const pqvec3_t &wp, const ray_t &sample, const intersection_surface_t *sampled_surface = nullptr) const noexcept
Probability density of a sampled direct connection from an emitter to a world position.
- Parameters:
sensor – used sensor
emitter – sampled emitter
wp – world position from which direct sampling was applied
sample – sampled emitter phase-space position (ray)
sampled_surface – sampled surface for emitter samples that seat on a surface (required for some emitters)
-
inline wavenumber_density_t sum_spectral_pdf_for_all_emitters(const sensor::sensor_t *sensor, const wavenumber_t k) const noexcept
Computes the spectral probability density for the given wavenumber
ksummed over all scene emitters: Useful for spectral MIS.- Parameters:
sensor – used sensor
k – sampled wavenumber
-
inline f_t pdf_emitter(const sensor::sensor_t *sensor, const emitter::emitter_t *emitter) const noexcept
Probability mass of sampling the emitter.
- Parameters:
sensor – used sensor
emitter – sampled emitter
-
inline wavenumber_density_t pdf_spectral_sample(const sensor::sensor_t *sensor, const emitter::emitter_t *emitter, const wavenumber_t k) const noexcept
Probability density of a wavenumber sample, given an emitter and a sensor.
- Parameters:
sensor – used sensor
emitter – used emitter
k – sampled wavenumber
-
inline wavenumber_density_t pdf_emitter_and_spectral_sample(const sensor::sensor_t *sensor, const emitter::emitter_t *emitter, const wavenumber_t k) const noexcept
Joint probability density of a wavenumber & emitter sample pair, given a sensor.
- Parameters:
sensor – used sensor
emitter – sampled emitter
k – wavenumber
-
scene::element::info_t description() const
Public Static Attributes
-
static constexpr std::size_t max_supported_sensors = 1
This defines the max count of sensors that the scene is willing to handle. WIP: machinery for multi-sensor rendering is working on scene side. However, currently multi-sensor rendering does not always makes sense, and we might want dedicated integrator support.
-
inline const auto &get_id() const
-
class scene_renderer_t
Scene renderer, handles rendering loop.
Public Types
-
using interrupt_t = std::unique_ptr<scene::interrupts::interrupt_t>
Public Functions
-
scene_renderer_t(const scene_t &scene, const wt_context_t &ctx, const ads::ads_t &ads, std::launch launch_mode = std::launch::async, scene::render_opts_t render_opts = {})
Queues rendering. Rendering is launched based on the launch policy
launch_policy: asynchronously or deferred. With deferred policy, rendering starts only when get() is called.
-
inline auto get()
Retrieves rendering results. This is a blocking operation.
-
inline void wait()
Waits for rendering to complete. This is a blocking operation.
-
inline auto wait_for(const duration_t &wait_duration)
Waits for rendering to complete. This is a blocking operation. When
wait_durationis 0, no blocking occurs and rendering state is returned.- Parameters:
wait_duration – maximal time to wait.
- Returns:
std::future_status
-
inline void interrupt(interrupt_t intr)
Queues an interrupt. See
wt::scene::interrupts. (Thread safe).
-
scene::rendering_status_t rendering_status() const noexcept
Queries the rendering status. Thread safe, returned results might be stale.
-
using interrupt_t = std::unique_ptr<scene::interrupts::interrupt_t>