Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::TSamplingFilm< Sample > Class Template Referenceabstract

A camera film that receives any quantity, for sampling-based rendering techniques. More...

#include <TSamplingFilm.h>

Inheritance diagram for ph::TSamplingFilm< Sample >:
ph::Film ph::IMoveOnly

Public Member Functions

 TSamplingFilm ()=default
 
 TSamplingFilm (int64 actualWidthPx, int64 actualHeightPx, const SampleFilter &filter)
 
 TSamplingFilm (int64 actualWidthPx, int64 actualHeightPx, const math::TAABB2D< int64 > &effectiveWindowPx, const SampleFilter &filter)
 
virtual void addSample (float64 xPx, float64 yPx, const Sample &sample)=0
 Applies filter to sample value and add to the film. Generally, this method can produce higher quality result by reconstruct the image function with a filter.
 
virtual void setPixel (float64 xPx, float64 yPx, const Sample &sample)=0
 Let the pixel developes to the specified sample value. An interface for using the film as an ordinary image. This method may disturb sample weights. Using this method with addSample() may result in image artifacts unless the implementation says otherwise.
 
void clear () override=0
 Set all pixel data to its initial state.
 
void setEffectiveWindowPx (const math::TAABB2D< int64 > &effectiveWindow) override
 Set the region where the film will be used. Implementation is advised to take advantage of this and only allocate memory for the part within the effective window.
 
void setSoftEdge (bool useSoftEdge, float32 softness=1.0f)
 Whether to increase the sampling window converage for prettier boundaries in developed frame. In renderings where the image is divided into tiles and sampled independently, the resulting image may have visible artifacts along tile boundaries. This can be alleviated by increasing the size of each tile, so edge pixels can receive more information, reducing their variance. This costs slightly more memory, and tiles will have overlapping sampling regions (may need more care for concurrency).
 
math::TVector2< float64 > getSampleResPx () const
 
const math::TAABB2D< float64 > & getSampleWindowPx () const
 
const SampleFiltergetFilter () const
 
SamplingFilmDimensions getDimensions () const
 
bool isSoftEdged () const
 
- Public Member Functions inherited from ph::Film
 Film ()
 
 Film (int64 actualWidthPx, int64 actualHeightPx)
 
 Film (int64 actualWidthPx, int64 actualHeightPx, const math::TAABB2D< int64 > &effectiveWindowPx)
 
 Film (Film &&other)=default
 
Filmoperator= (Film &&other)=default
 
virtual ~Film ()=default
 
virtual void setActualResPx (const math::TVector2< int64 > &actualResPx)
 Set the apparent size of the film. If only a sub-region of the film is going to be used, set the effective window accordingly may improve performance especially in memory usage.
 
void develop (HdrRgbFrame &out_frame) const
 
void develop (HdrRgbFrame &out_frame, const math::TAABB2D< int64 > &regionPx) const
 
const math::TVector2< int64 > & getActualResPx () const
 
math::TVector2< int64 > getEffectiveResPx () const
 
const math::TAABB2D< int64 > & getEffectiveWindowPx () const
 

Detailed Description

template<typename Sample>
class ph::TSamplingFilm< Sample >

A camera film that receives any quantity, for sampling-based rendering techniques.

Constructor & Destructor Documentation

◆ TSamplingFilm() [1/3]

template<typename Sample >
ph::TSamplingFilm< Sample >::TSamplingFilm ( )
default

◆ TSamplingFilm() [2/3]

template<typename Sample >
ph::TSamplingFilm< Sample >::TSamplingFilm ( int64 actualWidthPx,
int64 actualHeightPx,
const SampleFilter & filter )
inline

◆ TSamplingFilm() [3/3]

template<typename Sample >
ph::TSamplingFilm< Sample >::TSamplingFilm ( int64 actualWidthPx,
int64 actualHeightPx,
const math::TAABB2D< int64 > & effectiveWindowPx,
const SampleFilter & filter )
inline

Member Function Documentation

◆ addSample()

template<typename Sample >
virtual void ph::TSamplingFilm< Sample >::addSample ( float64 xPx,
float64 yPx,
const Sample & sample )
pure virtual

Applies filter to sample value and add to the film. Generally, this method can produce higher quality result by reconstruct the image function with a filter.

Parameters
xPxThe x coordinate in raster space.
yPxThe y coordinate in raster space.
sampleThe value to add as a sample.

Implemented in ph::HdrRgbFilm, and ph::Vector3Film.

◆ clear()

template<typename Sample >
void ph::TSamplingFilm< Sample >::clear ( )
overridepure virtual

Set all pixel data to its initial state.

Implements ph::Film.

Implemented in ph::HdrRgbFilm, and ph::Vector3Film.

◆ getDimensions()

template<typename Sample >
SamplingFilmDimensions ph::TSamplingFilm< Sample >::getDimensions ( ) const
inline

◆ getFilter()

template<typename Sample >
const SampleFilter & ph::TSamplingFilm< Sample >::getFilter ( ) const
inline

◆ getSampleResPx()

template<typename Sample >
math::TVector2< float64 > ph::TSamplingFilm< Sample >::getSampleResPx ( ) const
inline

◆ getSampleWindowPx()

template<typename Sample >
auto ph::TSamplingFilm< Sample >::getSampleWindowPx ( ) const
inline

◆ isSoftEdged()

template<typename Sample >
bool ph::TSamplingFilm< Sample >::isSoftEdged ( ) const
inline

◆ setEffectiveWindowPx()

template<typename Sample >
void ph::TSamplingFilm< Sample >::setEffectiveWindowPx ( const math::TAABB2D< int64 > & effectiveWindow)
inlineoverridevirtual

Set the region where the film will be used. Implementation is advised to take advantage of this and only allocate memory for the part within the effective window.

Reimplemented from ph::Film.

Reimplemented in ph::Vector3Film.

◆ setPixel()

template<typename Sample >
virtual void ph::TSamplingFilm< Sample >::setPixel ( float64 xPx,
float64 yPx,
const Sample & sample )
pure virtual

Let the pixel developes to the specified sample value. An interface for using the film as an ordinary image. This method may disturb sample weights. Using this method with addSample() may result in image artifacts unless the implementation says otherwise.

Parameters
xPxThe x coordinate in raster space.
yPxThe y coordinate in raster space.
sampleThe value the pixel will develop to.

Implemented in ph::HdrRgbFilm, and ph::Vector3Film.

◆ setSoftEdge()

template<typename Sample >
void ph::TSamplingFilm< Sample >::setSoftEdge ( bool useSoftEdge,
float32 softness = 1.0f )
inline

Whether to increase the sampling window converage for prettier boundaries in developed frame. In renderings where the image is divided into tiles and sampled independently, the resulting image may have visible artifacts along tile boundaries. This can be alleviated by increasing the size of each tile, so edge pixels can receive more information, reducing their variance. This costs slightly more memory, and tiles will have overlapping sampling regions (may need more care for concurrency).

Parameters
useSoftEdgeWhether prettier boundaries are needed or not. By default soft edge is enabled with maximum softness (1). If false, the value of softness will be ignored and set to 0.
softnessA value in [0, 1] to indicate the amount of increased size relative to the filter used. For a value of 1, the amount of expansion will be the radius of the filter.
Note
Using soft edge or not will not affect effective window in any way.

The documentation for this class was generated from the following files: