Abstract sensor interface. More...
#include <mitsuba/render/sensor.h>
Public Types | |
enum | ESensorFlags { EDeltaTime = 0x010, ENeedsApertureSample = 0x020, EProjectiveCamera = 0x100, EPerspectiveCamera = 0x200, EOrthographicCamera = 0x400, EPositionSampleMapsToPixels = 0x1000, EDirectionSampleMapsToPixels = 0x2000 } |
This list of flags is used to additionally characterize and classify the response functions of different types of sensors. More... | |
Public Types inherited from mitsuba::AbstractEmitter | |
enum | EEmitterType { EDeltaDirection = 0x01, EDeltaPosition = 0x02, EOnSurface = 0x04 } |
Flags used to classify the emission profile of different types of emitters. More... | |
Public Member Functions | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Additional sensor-related sampling functions | |
virtual Spectrum | sampleRay (Ray &ray, const Point2 &samplePosition, const Point2 &apertureSample, Float timeSample) const =0 |
Importance sample a ray according to the sensor response. More... | |
virtual Spectrum | sampleRayDifferential (RayDifferential &ray, const Point2 &samplePosition, const Point2 &apertureSample, Float timeSample) const |
Importance sample a ray differential according to the sensor response. More... | |
Float | sampleTime (Float sample) const |
Importance sample the temporal part of the sensor response function. More... | |
Additional query functions | |
virtual Spectrum | eval (const Intersection &its, const Vector &d, Point2 &samplePos) const |
Return the emitted importance for the given surface intersection. More... | |
virtual bool | getSamplePosition (const PositionSamplingRecord &pRec, const DirectionSamplingRecord &dRec, Point2 &position) const |
Return the sample position associated with a given position and direction sampling record. More... | |
Float | pdfTime (const Ray &ray, EMeasure measure) const |
Evaluate the temporal component of the sampling density implemented by the sampleRay() method. More... | |
Float | getShutterOpen () const |
Return the time value of the shutter opening event. More... | |
void | setShutterOpen (Float time) |
Set the time value of the shutter opening event. More... | |
Float | getShutterOpenTime () const |
Return the length, for which the shutter remains open. More... | |
void | setShutterOpenTime (Float time) |
Set the length, for which the shutter remains open. More... | |
bool | needsTimeSample () const |
Does the method sampleRay() require a uniformly distributed sample for the time-dependent component? More... | |
Miscellaneous | |
bool | needsApertureSample () const |
Does the method sampleRay() require a uniformly distributed sample for the aperture component? More... | |
Film * | getFilm () |
Return the Film instance associated with this sensor. More... | |
const Film * | getFilm () const |
Return the Film instance associated with this sensor (const) More... | |
Float | getAspect () const |
Return the aspect ratio of the sensor and its underlying film. More... | |
Sampler * | getSampler () |
Return the sensor's sample generator. More... | |
const Sampler * | getSampler () const |
Return the sensor's sampler (const version). More... | |
virtual void | serialize (Stream *stream, InstanceManager *manager) const |
Serialize this sensor to a binary data stream. More... | |
ConfigurableObject interface | |
virtual void | addChild (const std::string &name, ConfigurableObject *child) |
Add a child ConfigurableObject. More... | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
virtual void | configure () |
Configure the object (called once after construction and addition of all child ConfigurableObject instances). More... | |
Public Member Functions inherited from mitsuba::AbstractEmitter | |
virtual Spectrum | samplePosition (PositionSamplingRecord &pRec, const Point2 &sample, const Point2 *extra=NULL) const |
Importance sample the spatial component of the emission profile. More... | |
virtual Spectrum | sampleDirection (DirectionSamplingRecord &dRec, PositionSamplingRecord &pRec, const Point2 &sample, const Point2 *extra=NULL) const |
Conditioned on the spatial component, importance sample the directional part of the emission profile. More... | |
virtual Spectrum | sampleDirect (DirectSamplingRecord &dRec, const Point2 &sample) const |
Direct sampling: given a reference point in the scene, sample an emitter position that contributes towards it. More... | |
virtual Spectrum | evalPosition (const PositionSamplingRecord &pRec) const |
Evaluate the spatial component of the emission profile. More... | |
virtual Spectrum | evalDirection (const DirectionSamplingRecord &dRec, const PositionSamplingRecord &pRec) const |
Evaluate the directional component of the emission profile. More... | |
virtual Float | pdfPosition (const PositionSamplingRecord &pRec) const |
Evaluate the spatial component of the sampling density implemented by the samplePosition() method. More... | |
virtual Float | pdfDirection (const DirectionSamplingRecord &dRec, const PositionSamplingRecord &pRec) const |
Evaluate the directional component of the sampling density implemented by the sampleDirection() method. More... | |
virtual Float | pdfDirect (const DirectSamplingRecord &dRec) const |
Evaluate the probability density of the direct sampling method implemented by the sampleDirect() method. More... | |
uint32_t | getType () const |
Return a listing of classification flags combined using binary OR. More... | |
const AnimatedTransform * | getWorldTransform () const |
Return the local space to world space transformation. More... | |
void | setWorldTransform (AnimatedTransform *trafo) |
Set the local space to world space transformation. More... | |
bool | needsPositionSample () const |
Does the method samplePosition() require a uniformly distributed sample for the spatial component? More... | |
bool | needsDirectionSample () const |
Does the method sampleDirection() require a uniformly distributed sample for the direction component? More... | |
bool | isOnSurface () const |
Does the emitter lie on some kind of surface? More... | |
bool | isDegenerate () const |
Does the sensor have a degenerate directional or spatial distribution? More... | |
bool | needsDirectSample () const |
Does the method sampleDirect() require a uniformly distributed sample? More... | |
EMeasure | getDirectMeasure () const |
Return the measure associated with the sampleDirect() operation. More... | |
Medium * | getMedium () |
Return a pointer to the medium that surrounds the emitter. More... | |
const Medium * | getMedium () const |
Return a pointer to the medium that surrounds the emitter (const version) More... | |
Shape * | getShape () |
Return the shape, to which the emitter is currently attached. More... | |
const Shape * | getShape () const |
Return the shape, to which the emitter is currently attached (const version) More... | |
virtual ref< Shape > | createShape (const Scene *scene) |
Create a special shape that represents the emitter. More... | |
virtual AABB | getAABB () const =0 |
Return an axis-aligned box bounding the spatial extents of the emitter. More... | |
void | setMedium (Medium *medium) |
Set the medium that surrounds the emitter. More... | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
Public Member Functions inherited from mitsuba::ConfigurableObject | |
virtual void | setParent (ConfigurableObject *parent) |
Notify the ConfigurableObject instance about its parent object. More... | |
void | addChild (ConfigurableObject *child) |
Add an unnamed child. More... | |
const std::string & | getID () const |
Return the identifier associated with this instance (or "unnamed") More... | |
void | setID (const std::string &name) |
Set the identifier associated with this instance. More... | |
const Properties & | getProperties () const |
Return the properties object that was originally used to create this instance. More... | |
Public Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a serializable object. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::AbstractEmitter | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::ConfigurableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from mitsuba::SerializableObject | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
Sensor (const Properties &props) | |
Construct a new sensor instance. More... | |
Sensor (Stream *stream, InstanceManager *manager) | |
Unserialize a sensor instance from a binary data stream. More... | |
virtual | ~Sensor () |
Virtual destructor. More... | |
Protected Member Functions inherited from mitsuba::AbstractEmitter | |
AbstractEmitter (const Properties &props) | |
Construct a new emitter instance. More... | |
AbstractEmitter (Stream *stream, InstanceManager *manager) | |
Unserialize a emitter instance from a binary data stream. More... | |
virtual | ~AbstractEmitter () |
Virtual destructor. More... | |
Protected Member Functions inherited from mitsuba::ConfigurableObject | |
virtual | ~ConfigurableObject () |
Virtual destructor. More... | |
ConfigurableObject (const Properties &props) | |
Construct a configurable object. More... | |
ConfigurableObject (Stream *stream, InstanceManager *manager) | |
Unserialize a configurable object. More... | |
Protected Member Functions inherited from mitsuba::SerializableObject | |
SerializableObject () | |
Construct a serializable object. More... | |
virtual | ~SerializableObject () |
Virtual deconstructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Protected Attributes | |
ref< Film > | m_film |
ref< Sampler > | m_sampler |
Vector2 | m_resolution |
Vector2 | m_invResolution |
Float | m_shutterOpen |
Float | m_shutterOpenTime |
Float | m_aspect |
Protected Attributes inherited from mitsuba::AbstractEmitter | |
ref< const AnimatedTransform > | m_worldTransform |
ref< Medium > | m_medium |
Shape * | m_shape |
uint32_t | m_type |
Protected Attributes inherited from mitsuba::ConfigurableObject | |
Properties | m_properties |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Abstract sensor interface.
This class provides an abstract interface to all sensor plugins in Mitsuba. It exposes functions for evaluating and sampling the response function of the sensor, and it allows querying the probability density of the sampling method.
Somewhat curiously, the Sensor class derives from AbstractEmitter. The reason for this is that much like radiance, the spectral response of a sensor can be interpreted as emitted quantity named importance. The Sensor interface thus inherits almost all of the emitter API and only needs to add a few camera-specific methods on top.
The concept of interpreting sensor response as an emitted quantity and the resulting flexibility of being able to dynamically transition between emitter and receiver interpretations of luminaires and sensors is a key insight that enables the construction of powerful bidirectional rendering techniques It is the reason why the API to these components may seem somewhat unorthodox.
In Mitsuba, a sensor can be as simple as an irradiance meter that performs a single measurement along a specified ray, but it can also represent sensors that are more commonly used in computer graphics, such as a perspective camera based on the thin lens equation.
An important difference between a luminaire and a sensor is that the sensor records spectral measurements to a film, and for that reason it needs a mapping between rays and film pixel coordinates. Apart from that, the interfaces are almost identical.
Mitsuba assumes that a sensor always has a form of "shutter", which opens for a certain time, during which the exposure takes place. The sensor itself may also undergo motion while the shutter is open, but a more complicated dependence on time is not allowed.
This list of flags is used to additionally characterize and classify the response functions of different types of sensors.
Enumerator | |
---|---|
EDeltaTime |
Sensor response contains a Dirac delta term with respect to time. |
ENeedsApertureSample |
Does the sampleRay() function need an aperture sample? |
EProjectiveCamera |
Is the sensor a projective camera? |
EPerspectiveCamera |
Is the sensor a perspective camera? |
EOrthographicCamera |
Is the sensor an orthographic camera? |
EPositionSampleMapsToPixels |
Does the sample given to samplePosition() determine the pixel coordinates. |
EDirectionSampleMapsToPixels |
Does the sample given to sampleDirection() determine the pixel coordinates. |
|
protected |
Construct a new sensor instance.
|
protected |
Unserialize a sensor instance from a binary data stream.
|
protectedvirtual |
Virtual destructor.
|
virtual |
Add a child ConfigurableObject.
Reimplemented from mitsuba::AbstractEmitter.
|
inline |
Add an unnamed child.
|
virtual |
Configure the object (called once after construction and addition of all child ConfigurableObject instances).
Reimplemented from mitsuba::ConfigurableObject.
Reimplemented in mitsuba::PerspectiveCamera.
|
virtual |
Return the emitted importance for the given surface intersection.
This is function is used when a sensor has been hit by a ray in a particle tracing-style integrator, and it subsequently needs to be queried for the emitted importance along the negative ray direction.
It efficiently computes the product of evalPosition() and evalDirection(), though note that it does not include the cosine foreshortening factor of the latter method.
This function is provided here as a fast convenience function for unidirectional rendering techniques that support intersecting the sensor. The default implementation throws an exception, which states that the method is not implemented.
its | An intersect record that specfies the query position |
d | A unit vector, which specifies the query direction |
result | This argument is used to return the 2D sample position (i.e. the fractional pixel coordinates) associated with the intersection. |
spectrum, samplePos = sensor.eval(its, d)
|
inline |
Return the aspect ratio of the sensor and its underlying film.
|
virtual |
Retrieve this object's class.
Reimplemented from mitsuba::AbstractEmitter.
Reimplemented in mitsuba::PerspectiveCamera, and mitsuba::ProjectiveCamera.
|
inline |
Return the Film instance associated with this sensor (const)
|
virtual |
Return the sample position associated with a given position and direction sampling record.
dRec | A direction sampling record, which specifies the query direction |
pRec | A position sampling record, which specifies the query position |
true
if the specified ray is visible by the cameravisible, position = sensor.getSamplePosition(pRec, dRec)
|
inline |
Return the sensor's sample generator.
This is the root sampler, which will later be cloned a number of times to provide each participating worker thread with its own instance (see Scene::getSampler()). Therefore, this sampler should never be used for anything except creating clones.
|
inline |
Return the sensor's sampler (const version).
This is the root sampler, which will later be cloned a number of times to provide each participating worker thread with its own instance (see Scene::getSampler()). Therefore, this sampler should never be used for anything except creating clones.
|
inline |
Return the time value of the shutter opening event.
|
inline |
Return the length, for which the shutter remains open.
|
inline |
Does the method sampleRay() require a uniformly distributed sample for the aperture component?
|
inline |
Does the method sampleRay() require a uniformly distributed sample for the time-dependent component?
Evaluate the temporal component of the sampling density implemented by the sampleRay() method.
|
pure virtual |
Importance sample a ray according to the sensor response.
This function combines all three of the steps of sampling a time, ray position, and direction value. It does not return any auxiliary sampling information and is mainly meant to be used by unidirectional rendering techniques.
Note that this function potentially uses a different sampling strategy compared to the sequence of running sampleArea() and sampleDirection(). The reason for this is that it may be possible to switch to a better technique when sampling both position and direction at the same time.
ray | A ray data structure to be populated with a position and direction value |
samplePosition | Denotes the desired sample position in fractional pixel coordinates relative to the crop window of the underlying film. |
apertureSample | A uniformly distributed 2D vector that is used to sample a position on the aperture of the sensor if necessary. (Any value is valid when needsApertureSample() == false ) |
timeSample | A uniformly distributed 1D vector that is used to sample the temporal component of the emission profile. (Or any value when needsTimeSample() == false ) |
spectrum, ray = sensor.sampleRay(samplePosition, apertureSample)
|
virtual |
Importance sample a ray differential according to the sensor response.
This function combines all three of the steps of sampling a time, ray position, and direction value. It does not return any auxiliary sampling information and is mainly meant to be used by unidirectional rendering techniques.
Note that this function potentially uses a different sampling strategy compared to the sequence of running sampleArea() and sampleDirection(). The reason for this is that it may be possible to switch to a better technique when sampling both position and direction at the same time.
The default implementation computes differentials using several internal calls to sampleRay(). Subclasses of the Sensor interface may optionally provide a more efficient approach.
ray | A ray data structure to be populated with a position and direction value |
samplePosition | Denotes the desired sample position in fractional pixel coordinates relative to the crop window of the underlying film. |
apertureSample | A uniformly distributed 2D vector that is used to sample a position on the aperture of the sensor if necessary. (Any value is valid when needsApertureSample() == false ) |
timeSample | A uniformly distributed 1D vector that is used to sample the temporal component of the emission profile. (Or any value when needsTimeSample() == false ) |
spectrum, ray = sensor.sampleRayDifferential(samplePosition, apertureSample)
Importance sample the temporal part of the sensor response function.
|
virtual |
Serialize this sensor to a binary data stream.
Reimplemented from mitsuba::AbstractEmitter.
Reimplemented in mitsuba::PerspectiveCamera, and mitsuba::ProjectiveCamera.
|
inline |
Set the time value of the shutter opening event.
void mitsuba::Sensor::setShutterOpenTime | ( | Float | time | ) |
Set the length, for which the shutter remains open.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |