LuxCore  2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
luxcore::Film Class Referenceabstract

Film stores all the outputs of a rendering. It can be obtained from a RenderSession or as stand alone object loaded from a file. More...

#include <luxcore.h>

Public Types

enum  FilmOutputType {
  OUTPUT_RGB, OUTPUT_RGBA, OUTPUT_RGB_IMAGEPIPELINE, OUTPUT_RGBA_IMAGEPIPELINE,
  OUTPUT_ALPHA, OUTPUT_DEPTH, OUTPUT_POSITION, OUTPUT_GEOMETRY_NORMAL,
  OUTPUT_SHADING_NORMAL, OUTPUT_MATERIAL_ID, OUTPUT_DIRECT_DIFFUSE, OUTPUT_DIRECT_GLOSSY,
  OUTPUT_EMISSION, OUTPUT_INDIRECT_DIFFUSE, OUTPUT_INDIRECT_GLOSSY, OUTPUT_INDIRECT_SPECULAR,
  OUTPUT_MATERIAL_ID_MASK, OUTPUT_DIRECT_SHADOW_MASK, OUTPUT_INDIRECT_SHADOW_MASK, OUTPUT_RADIANCE_GROUP,
  OUTPUT_UV, OUTPUT_RAYCOUNT, OUTPUT_BY_MATERIAL_ID, OUTPUT_IRRADIANCE,
  OUTPUT_OBJECT_ID, OUTPUT_OBJECT_ID_MASK, OUTPUT_BY_OBJECT_ID, OUTPUT_FRAMEBUFFER_MASK,
  OUTPUT_SAMPLECOUNT, OUTPUT_CONVERGENCE
}
 Types of Film channel available. More...
 
enum  FilmChannelType {
  CHANNEL_RADIANCE_PER_PIXEL_NORMALIZED = 1 << 0, CHANNEL_RADIANCE_PER_SCREEN_NORMALIZED = 1 << 1, CHANNEL_ALPHA = 1 << 2, CHANNEL_IMAGEPIPELINE = 1 << 3,
  CHANNEL_DEPTH = 1 << 4, CHANNEL_POSITION = 1 << 5, CHANNEL_GEOMETRY_NORMAL = 1 << 6, CHANNEL_SHADING_NORMAL = 1 << 7,
  CHANNEL_MATERIAL_ID = 1 << 8, CHANNEL_DIRECT_DIFFUSE = 1 << 9, CHANNEL_DIRECT_GLOSSY = 1 << 10, CHANNEL_EMISSION = 1 << 11,
  CHANNEL_INDIRECT_DIFFUSE = 1 << 12, CHANNEL_INDIRECT_GLOSSY = 1 << 13, CHANNEL_INDIRECT_SPECULAR = 1 << 14, CHANNEL_MATERIAL_ID_MASK = 1 << 15,
  CHANNEL_DIRECT_SHADOW_MASK = 1 << 16, CHANNEL_INDIRECT_SHADOW_MASK = 1 << 17, CHANNEL_UV = 1 << 18, CHANNEL_RAYCOUNT = 1 << 19,
  CHANNEL_BY_MATERIAL_ID = 1 << 20, CHANNEL_IRRADIANCE = 1 << 21, CHANNEL_OBJECT_ID = 1 << 22, CHANNEL_OBJECT_ID_MASK = 1 << 23,
  CHANNEL_BY_OBJECT_ID = 1 << 24, CHANNEL_FRAMEBUFFER_MASK = 1 << 25, CHANNEL_SAMPLECOUNT = 1 << 26, CHANNEL_CONVERGENCE = 1 << 27
}
 Types of Film channel available. More...
 

Public Member Functions

virtual ~Film ()
 
virtual unsigned int GetWidth () const =0
 Returns the Film width. More...
 
virtual unsigned int GetHeight () const =0
 Returns the Film height. More...
 
virtual luxrays::Properties GetStats () const =0
 Returns a list of statistics related to the film. Mostly useful for stand alone films. More...
 
virtual float GetFilmY (const unsigned int imagePipelineIndex=0) const =0
 Returns the Film average luminance. It can be used to estimate a good value for variance clamping. More...
 
virtual void Clear ()=0
 Clear the film. More...
 
virtual void AddFilm (const Film &film)=0
 Add a film. More...
 
virtual void AddFilm (const Film &film, const unsigned int srcOffsetX, const unsigned int srcOffsetY, const unsigned int srcWidth, const unsigned int srcHeight, const unsigned int dstOffsetX, const unsigned int dstOffsetY)=0
 Add a film. More...
 
virtual void SaveOutputs () const =0
 Saves all Film output channels defined in the current RenderSession. This method can not be used with a standalone film. More...
 
virtual void SaveOutput (const std::string &fileName, const FilmOutputType type, const luxrays::Properties &props) const =0
 Saves the specified Film output channels. More...
 
virtual void SaveFilm (const std::string &fileName) const =0
 Serializes a Film in a file. More...
 
virtual double GetTotalSampleCount () const =0
 Returns the total sample count. More...
 
virtual size_t GetOutputSize (const FilmOutputType type) const =0
 Returns the size (in float or unsigned int) of a Film output channel. More...
 
virtual bool HasOutput (const FilmOutputType type) const =0
 Returns if a film channel output is available. More...
 
virtual unsigned int GetOutputCount (const FilmOutputType type) const =0
 Returns the number of output channels of the passed type. More...
 
virtual unsigned int GetRadianceGroupCount () const =0
 Returns the number of radiance groups. More...
 
template<class T >
void GetOutput (const FilmOutputType type, T *buffer, const unsigned int index=0)
 Fills the buffer with a Film output channel. More...
 
virtual bool HasChannel (const FilmChannelType type) const =0
 Returns if a film channel is available. More...
 
virtual unsigned int GetChannelCount (const FilmChannelType type) const =0
 Returns the number of channels of the passed type. More...
 
template<class T >
const T * GetChannel (const FilmChannelType type, const unsigned int index=0)
 Returns a pointer to the type of channel requested. The channel is not normalized (if it has a weight channel). More...
 
virtual void Parse (const luxrays::Properties &props)=0
 Sets configuration Properties with new values. This method can be used only when the Film is not in use by a RenderSession. Image pipeline and radiance scale values can be redefined with this method. More...
 
virtual void DeleteAllImagePipelines ()=0
 Delete all image pipelines and goes the default image pipeline (AutoLinearToneMap + GammaCorrectionPlugin). This method can be used with a stand alone film or with a session film. More...
 
template<>
CPP_API void GetOutput (const FilmOutputType type, float *buffer, const unsigned int index)
 
template<>
CPP_API void GetOutput (const FilmOutputType type, unsigned int *buffer, const unsigned int index)
 
template<>
CPP_API const float * GetChannel (const FilmChannelType type, const unsigned int index)
 
template<>
CPP_API const unsigned int * GetChannel (const FilmChannelType type, const unsigned int index)
 

Static Public Member Functions

static FilmCreate (const std::string &fileName)
 Loads a stand alone Film (i.e. not connected to a rendering session) from a file. More...
 
static FilmCreate (const luxrays::Properties &props, const bool hasPixelNormalizedChannel, const bool hasScreenNormalizedChannel)
 Create a stand alone Film (i.e. not connected to a rendering session) from the properties. More...
 

Protected Member Functions

virtual void GetOutputFloat (const FilmOutputType type, float *buffer, const unsigned int index)=0
 
virtual void GetOutputUInt (const FilmOutputType type, unsigned int *buffer, const unsigned int index)=0
 
virtual const float * GetChannelFloat (const FilmChannelType type, const unsigned int index)=0
 
virtual const unsigned int * GetChannelUInt (const FilmChannelType type, const unsigned int index)=0
 

Detailed Description

Film stores all the outputs of a rendering. It can be obtained from a RenderSession or as stand alone object loaded from a file.

Definition at line 150 of file luxcore.h.

Member Enumeration Documentation

Types of Film channel available.

Enumerator
CHANNEL_RADIANCE_PER_PIXEL_NORMALIZED 
CHANNEL_RADIANCE_PER_SCREEN_NORMALIZED 
CHANNEL_ALPHA 
CHANNEL_IMAGEPIPELINE 
CHANNEL_DEPTH 
CHANNEL_POSITION 
CHANNEL_GEOMETRY_NORMAL 
CHANNEL_SHADING_NORMAL 
CHANNEL_MATERIAL_ID 
CHANNEL_DIRECT_DIFFUSE 
CHANNEL_DIRECT_GLOSSY 
CHANNEL_EMISSION 
CHANNEL_INDIRECT_DIFFUSE 
CHANNEL_INDIRECT_GLOSSY 
CHANNEL_INDIRECT_SPECULAR 
CHANNEL_MATERIAL_ID_MASK 
CHANNEL_DIRECT_SHADOW_MASK 
CHANNEL_INDIRECT_SHADOW_MASK 
CHANNEL_UV 
CHANNEL_RAYCOUNT 
CHANNEL_BY_MATERIAL_ID 
CHANNEL_IRRADIANCE 
CHANNEL_OBJECT_ID 
CHANNEL_OBJECT_ID_MASK 
CHANNEL_BY_OBJECT_ID 
CHANNEL_FRAMEBUFFER_MASK 
CHANNEL_SAMPLECOUNT 
CHANNEL_CONVERGENCE 

Definition at line 192 of file luxcore.h.

Types of Film channel available.

Enumerator
OUTPUT_RGB 
OUTPUT_RGBA 
OUTPUT_RGB_IMAGEPIPELINE 
OUTPUT_RGBA_IMAGEPIPELINE 
OUTPUT_ALPHA 
OUTPUT_DEPTH 
OUTPUT_POSITION 
OUTPUT_GEOMETRY_NORMAL 
OUTPUT_SHADING_NORMAL 
OUTPUT_MATERIAL_ID 
OUTPUT_DIRECT_DIFFUSE 
OUTPUT_DIRECT_GLOSSY 
OUTPUT_EMISSION 
OUTPUT_INDIRECT_DIFFUSE 
OUTPUT_INDIRECT_GLOSSY 
OUTPUT_INDIRECT_SPECULAR 
OUTPUT_MATERIAL_ID_MASK 
OUTPUT_DIRECT_SHADOW_MASK 
OUTPUT_INDIRECT_SHADOW_MASK 
OUTPUT_RADIANCE_GROUP 
OUTPUT_UV 
OUTPUT_RAYCOUNT 
OUTPUT_BY_MATERIAL_ID 
OUTPUT_IRRADIANCE 
OUTPUT_OBJECT_ID 
OUTPUT_OBJECT_ID_MASK 
OUTPUT_BY_OBJECT_ID 
OUTPUT_FRAMEBUFFER_MASK 
OUTPUT_SAMPLECOUNT 
OUTPUT_CONVERGENCE 

Definition at line 155 of file luxcore.h.

Constructor & Destructor Documentation

virtual luxcore::Film::~Film ( )
virtual

Member Function Documentation

virtual void luxcore::Film::AddFilm ( const Film film)
pure virtual

Add a film.

Parameters
filmthe film to add.
virtual void luxcore::Film::AddFilm ( const Film film,
const unsigned int  srcOffsetX,
const unsigned int  srcOffsetY,
const unsigned int  srcWidth,
const unsigned int  srcHeight,
const unsigned int  dstOffsetX,
const unsigned int  dstOffsetY 
)
pure virtual

Add a film.

Parameters
filmthe film to add.
srcOffsetXthe X offset of the region of the film to add.
srcOffsetYthe y offset of the region of the film to add.
srcWidththe width of the region of the film to add.
srcHeightthe height of the region of the film to add.
dstOffsetXthe X offset of the destination film.
dstOffsetYthe Y offset of the destination film.
virtual void luxcore::Film::Clear ( )
pure virtual

Clear the film.

static Film* luxcore::Film::Create ( const std::string &  fileName)
static

Loads a stand alone Film (i.e. not connected to a rendering session) from a file.

Parameters
fileNameis the name of the file with the serialized film to read.
static Film* luxcore::Film::Create ( const luxrays::Properties props,
const bool  hasPixelNormalizedChannel,
const bool  hasScreenNormalizedChannel 
)
static

Create a stand alone Film (i.e. not connected to a rendering session) from the properties.

Parameters
propsdefining the film.
hasPixelNormalizedChannelif the film must have CHANNEL_RADIANCE_PER_PIXEL_NORMALIZED. Required by all render engines.
hasScreenNormalizedChannelif the film must have CHANNEL_RADIANCE_PER_SCREEN_NORMALIZED. Required by BIDIRCPU and LIGHTCPU render engines.
virtual void luxcore::Film::DeleteAllImagePipelines ( )
pure virtual

Delete all image pipelines and goes the default image pipeline (AutoLinearToneMap + GammaCorrectionPlugin). This method can be used with a stand alone film or with a session film.

template<class T >
const T* luxcore::Film::GetChannel ( const FilmChannelType  type,
const unsigned int  index = 0 
)
inline

Returns a pointer to the type of channel requested. The channel is not normalized (if it has a weight channel).

Parameters
typeis the Film output channel to return. It must be one of the enabled channels in RenderConfig. The supported template types are float and unsigned int.
indexof the buffer to use. Usually 0, however, for instance, if more than one light group is used, select the group to return.
Returns
a pointer to the requested raw buffer.

Definition at line 409 of file luxcore.h.

template<>
CPP_API const float* luxcore::Film::GetChannel ( const FilmChannelType  type,
const unsigned int  index 
)
template<>
CPP_API const unsigned int* luxcore::Film::GetChannel ( const FilmChannelType  type,
const unsigned int  index 
)
virtual unsigned int luxcore::Film::GetChannelCount ( const FilmChannelType  type) const
pure virtual

Returns the number of channels of the passed type.

Parameters
typeis the Film channel to use.
Returns
the number of channels. Returns 0 if the channel is not available.
virtual const float* luxcore::Film::GetChannelFloat ( const FilmChannelType  type,
const unsigned int  index 
)
protectedpure virtual
virtual const unsigned int* luxcore::Film::GetChannelUInt ( const FilmChannelType  type,
const unsigned int  index 
)
protectedpure virtual
virtual float luxcore::Film::GetFilmY ( const unsigned int  imagePipelineIndex = 0) const
pure virtual

Returns the Film average luminance. It can be used to estimate a good value for variance clamping.

Parameters
imagePipelineIndexthe index of the image pipeline radiance group scale to use.
Returns
the Film average luminance.
virtual unsigned int luxcore::Film::GetHeight ( ) const
pure virtual

Returns the Film height.

Returns
the Film width.
template<class T >
void luxcore::Film::GetOutput ( const FilmOutputType  type,
T *  buffer,
const unsigned int  index = 0 
)
inline

Fills the buffer with a Film output channel.

Parameters
typeis the Film output channel to use. It must be one of the enabled channels in RenderConfig. The supported template types are float and unsigned int.
bufferis the place where the data will be copied.
indexof the buffer to use. Usually 0, however, for instance, if more than one light group is used, select the group to return.

Definition at line 378 of file luxcore.h.

template<>
CPP_API void luxcore::Film::GetOutput ( const FilmOutputType  type,
float *  buffer,
const unsigned int  index 
)
template<>
CPP_API void luxcore::Film::GetOutput ( const FilmOutputType  type,
unsigned int *  buffer,
const unsigned int  index 
)
virtual unsigned int luxcore::Film::GetOutputCount ( const FilmOutputType  type) const
pure virtual

Returns the number of output channels of the passed type.

Parameters
typeis the Film output channel to use.
Returns
the number of output channels. Returns 0 if the output channel is not available.
virtual void luxcore::Film::GetOutputFloat ( const FilmOutputType  type,
float *  buffer,
const unsigned int  index 
)
protectedpure virtual
virtual size_t luxcore::Film::GetOutputSize ( const FilmOutputType  type) const
pure virtual

Returns the size (in float or unsigned int) of a Film output channel.

Parameters
typeis the Film output channel to use.
Returns
the size (in float or unsigned int) of a Film output channel.
virtual void luxcore::Film::GetOutputUInt ( const FilmOutputType  type,
unsigned int *  buffer,
const unsigned int  index 
)
protectedpure virtual
virtual unsigned int luxcore::Film::GetRadianceGroupCount ( ) const
pure virtual

Returns the number of radiance groups.

Returns
the number of radiance groups.
virtual luxrays::Properties luxcore::Film::GetStats ( ) const
pure virtual

Returns a list of statistics related to the film. Mostly useful for stand alone films.

Returns
a Properties container with the statistics.
virtual double luxcore::Film::GetTotalSampleCount ( ) const
pure virtual

Returns the total sample count.

Returns
the total sample count.
virtual unsigned int luxcore::Film::GetWidth ( ) const
pure virtual

Returns the Film width.

Returns
the Film width.
virtual bool luxcore::Film::HasChannel ( const FilmChannelType  type) const
pure virtual

Returns if a film channel is available.

Parameters
typeis the Film channel to use.
Returns
true if the output is available, false otherwise.
virtual bool luxcore::Film::HasOutput ( const FilmOutputType  type) const
pure virtual

Returns if a film channel output is available.

Parameters
typeis the Film output channel to use.
Returns
true if the output is available, false otherwise.
virtual void luxcore::Film::Parse ( const luxrays::Properties props)
pure virtual

Sets configuration Properties with new values. This method can be used only when the Film is not in use by a RenderSession. Image pipeline and radiance scale values can be redefined with this method.

Parameters
propsare the Properties to set.
virtual void luxcore::Film::SaveFilm ( const std::string &  fileName) const
pure virtual

Serializes a Film in a file.

Parameters
fileNameis the name of the file where to serialize the film.
virtual void luxcore::Film::SaveOutput ( const std::string &  fileName,
const FilmOutputType  type,
const luxrays::Properties props 
) const
pure virtual

Saves the specified Film output channels.

Parameters
fileNameis the name of the file where to save the output channel.
typeis the Film output channel to use. It must be one of the enabled channels.
propscan include some additional information defined by the following property: "id" for the ID of MATERIAL_ID_MASK, "id" for the index of RADIANCE_GROUP, "id" for the ID of BY_MATERIAL_ID. "id" for the ID of OBJECT_ID_MASK, "id" for the ID of BY_OBJECT_ID.
virtual void luxcore::Film::SaveOutputs ( ) const
pure virtual

Saves all Film output channels defined in the current RenderSession. This method can not be used with a standalone film.


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