class RED::PostProcess

This class defines methods to setup and apply various post processing operations to images. More...

#include <REDPostProcess.h>

Inherits: Object.

Public functions:

PostProcess ( RED::Object * iResourceManager )
PostProcess ( const PostProcess & iSource )
virtual ~PostProcess ( )
virtual void *As ( const RED::CID & iCID )
virtual const void *As ( const RED::CID & iCID ) const
template< class T_As > const T_As *As ( ) const
template< class T_As > T_As *As ( )
floatGetBlur ( ) const
intGetBlurKernelSize ( ) const
floatGetBrightness ( ) const
floatGetBurnFactor ( ) const
floatGetContrast ( ) const
RED_RCGetCurve ( RED::Vector< float > & oX, RED::Vector< float > & oValue )
RED_RCGetCurveRamp ( RED::Object *& oRamp )
voidGetDepthLine ( float & oIntensity, float & oDepth ) const
const RED::Color &GetDepthLineColor ( ) const
floatGetDepthLineWidth ( ) const
voidGetDOF ( float & oDOF, float & oNearMin, float & oNearMax, float & oFarMin, float & oFarMax ) const
intGetDOFKernelSize ( ) const
floatGetExposure ( ) const
floatGetGamma ( ) const
floatGetGlow ( ) const
intGetGlowKernelSize ( ) const
floatGetGlowThreshold ( ) const
voidGetHSL ( float & oHue, float & oSaturation, float & oLightness ) const
floatGetKey ( ) const
voidGetLevels ( float & oInputBlack, float & oInputWhite, float & oOutputBlack, float & oOutputWhite ) const
voidGetLuminanceInformation ( float & oAverageLuminance, float & oLogAverageLuminance, unsigned int & oSamplesCount, float & oMinLuminance, float & oMaxLuminance ) const
voidGetLuminanceOverride ( float & oAverageLuminance, float & oLogAverageLuminance, unsigned int & oSamplesCount, float & oMinLuminance, float & oMaxLuminance ) const
voidGetLUT ( RED::Vector< unsigned char > & oTable, unsigned int & oSize ) const
RED_RCGetLUTImage ( RED::Object *& oImage3D )
floatGetSharpen ( ) const
intGetSharpenKernelSize ( ) const
RED::TONEMAPPING_OPERATORGetToneMapping ( ) const
floatGetVignette ( ) const
const RED::Color &GetVignetteColor ( ) const
floatGetVignetteRoundness ( ) const
floatGetVignetteSize ( ) const
floatGetVignetteSmoothness ( ) const
const RED::Color &GetWhiteReference ( ) const
boolHasLegacyBrightnessContrast ( ) const
boolIsAutoKey ( ) const
boolIsColorOperationsNeutral ( ) const
boolIsCurveNeutral ( ) const
boolIsLuminanceOverriden ( ) const
boolIsNeutral ( ) const
RED_RCLoadLUT ( const RED::String & iFilePath )
RED_RCoperator= ( const RED::PostProcess & iOther )
RED_RCOverrideLuminance ( float iAverageLuminance, float iLogAverageLuminance, unsigned int iSamplesCount, float iMinLuminance, float iMaxLuminance )
RED_RCProcessBlurPass1 ( float oColor[4], const float * iColorBuffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessBlurPass2 ( float oColor[4], const float * iColorBuffer, const float * iPass1Buffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessColorOperations ( float oColor[4], const float iColor[4] )
RED_RCProcessDepthLine ( float oColor[4], const float iColor[4], float iDepth )
RED_RCProcessDOFPass1 ( float oColor[4], const float * iColorBuffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessDOFPass2 ( float oColor[4], const float * iColorBuffer, const float * iPass1Buffer, int iWidth, int iHeight, int iIndexX, int iIndexY, float iDepth )
RED_RCProcessGlowPass1 ( float oColor[4], const float * iColorBuffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessGlowPass2 ( float oColor[4], const float * iColorBuffer, const float * iPass1Buffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessGlowPass3 ( float oColor[4], const float * iColorBuffer, const float * iPass2Buffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessLUT ( float oColor[4], const float iColor[4] )
RED_RCProcessSharpen ( float oColor[4], const float * iColorBuffer, int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCProcessToneMapping ( float oColor[4], const float iColor[4], float iAverageLuminance, float iLogAverageLuminance, float iMinLuminance, float iMaxLuminance )
RED_RCProcessToneMappingAA ( float oColor[4], const double iColor[4], float iAverageLuminance, float iLogAverageLuminance, float iMinLuminance, float iMaxLuminance, bool iIgnoreBackground )
RED_RCProcessVignette ( float oColor[4], const float iColor[4], int iWidth, int iHeight, int iIndexX, int iIndexY )
RED_RCReset ( )
RED_RCResetCurve ( )
voidResetLuminanceOverride ( )
voidSetAutoKey ( bool iAutoKey )
RED_RCSetBlur ( float iBlur )
RED_RCSetBlurKernelSize ( int iSize )
RED_RCSetBrightness ( float iBrightness )
RED_RCSetBurnFactor ( float iBurn )
RED_RCSetContrast ( float iContrast )
RED_RCSetCurve ( const RED::Vector< float > & iX, const RED::Vector< float > & iValue )
RED_RCSetDepthLine ( float iIntensity, float iDepth )
RED_RCSetDepthLineColor ( const RED::Color & iColor )
RED_RCSetDepthLineWidth ( float iWidth )
RED_RCSetDOF ( float iDOF, float iNearMin, float iNearMax, float iFarMin, float iFarMax )
RED_RCSetDOFKernelSize ( int iSize )
RED_RCSetExposure ( float iExposure )
RED_RCSetGamma ( float iGamma )
RED_RCSetGlow ( float iGlow )
RED_RCSetGlowKernelSize ( int iSize )
RED_RCSetGlowThreshold ( float iThreshold )
RED_RCSetHSL ( float iHue, float iSaturation, float iLightness )
RED_RCSetKey ( float iKey )
RED_RCSetLegacyBrightnessContrast ( bool iLegacy = true )
RED_RCSetLevels ( float iInputBlack, float iInputWhite, float iOutputBlack, float iOutputWhite )
RED_RCSetLuminanceInformation ( float iAverageLuminance, float iLogAverageLuminance, unsigned int iSamplesCount, float iMinLuminance, float iMaxLuminance ) const
RED_RCSetLUT ( const RED::Vector< unsigned char > & iTable, unsigned int iSize )
RED_RCSetSharpen ( float iSharpen )
RED_RCSetSharpenKernelSize ( int iSize )
RED_RCSetToneMapping ( RED::TONEMAPPING_OPERATOR iToneMappingOperator )
RED_RCSetVignette ( float iIntensity )
RED_RCSetVignetteColor ( const RED::Color & iColor )
RED_RCSetVignetteRoundness ( float iRoundness )
RED_RCSetVignetteSize ( float iSize )
RED_RCSetVignetteSmoothness ( float iSmoothness )
RED_RCSetWhiteReference ( const RED::Color & iWhite )

Public static functions:

static RED::CIDGetClassID ( )

Protected functions:

RED_RCInitCurveRamp ( )
RED_RCInitLUTImage ( )
RED_RCResetLUTImage ( )

Protected variables:

bool_auto_key
float_blur
int_blur_kernel_size
float_brightness
float_burn
RED::Color_color_balance
float_contrast
RED::Vector< float >_curve_samples
RED::Object *_curve_tex
float_depth_line
RED::Color_depth_line_color
float_depth_line_depth
float_depth_line_width
float_dof
float_dof_far_max
float_dof_far_min
int_dof_kernel_size
float_dof_near_max
float_dof_near_min
float_exposure
float_gamma
float_glow
int_glow_kernel_size
float_glow_threshold
float_hue
float_info_lum_avg
float_info_lum_log_avg
float_info_lum_max
float_info_lum_min
unsigned int_info_lum_samples_count
float_key
bool_legacy_bc
float_level_in_black
float_level_in_white
float_level_out_black
float_level_out_white
float_lightness
float_lum_avg
bool_lum_is_overriden
float_lum_log_avg
float_lum_max
float_lum_min
unsigned int_lum_samples_count
RED::Vector< unsigned char >_lut
unsigned int_lut_size
RED::Object *_lut_tex
RED::Object *_resmgr
float_saturation
float_sharpen
int_sharpen_kernel_size
RED::TONEMAPPING_OPERATOR_tone_mapping
float_vignette
RED::Color_vignette_color
float_vignette_roundness
float_vignette_size
float_vignette_smoothness
RED::Color_white_ref

Detailed description:

This class defines methods to setup and apply various post processing operations to images.

Each viewpoint in REDsdk can have a PostProcess instance set on. This will turn on post processing of images rendered using those viewpoints. Post processing includes:

When running in hardware or hybrid rendering modes, post processing operations are performed using the GPU and therefore have a lot smaller cost than when ran entirely in software.

There are several differences to consider on tonemapping the contents of a RED::IViewpointRenderList:

Using RED::IViewpointRenderList::SetViewpointSoftImages acts as rendering with a RED::IWindow::FrameTracing call.

Calling RED::IViewpointRenderList::SetViewpointSoftMatrix if necessary when calling RED::IViewpointRenderList::SetViewpointSoftImages to use effects where depth is involved (DOF, Depth line).

The post process class is NOT managed by RED::State transactions. Therefore it should be manipulated only from the rendering thread. It can be changed anytime from that thread and from that thread only between two draws without having to open a transaction. This can be used to implement dynamic tonemapping loops that can be used to modify an image while it's rendered or after the rendering has finished.

Functions documentation

public RED::PostProcess::PostProcess(RED::Object *iResourceManager)

Constructor.

By default, values are set to:

  • tone mapping is RED::TMO_NEUTRAL
  • exposure is 1.0
  • gamma is 1.0
  • curve is identity (straight line)
  • white reference is (1.0,1.0,1.0)
  • auto key is on
  • sharpen is 0.0
  • glow is 0.0
  • blur is 0.0
  • DOF is 0.0
  • brightness and contrast are 0.0
  • hue, saturation and lightness are 0.0
  • levels black are 0.0 and white are 1.0.

Which leads to a neutral RED::PostProcess instance (see RED::PostProcess::IsNeutral).

Parameters:

iResourceManager:Pointer to the cluster's resource manager.

Copy constructor.

Parameters:

iSource:Source for the copy.

Destructor.

public virtual void * RED::PostProcess::As(const RED::CID &iCID)

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::Object::As.

public virtual const void * RED::PostProcess::As(const RED::CID &iCID) const

Converts the object to an instance of the given type.

Parameters:

iCID:Requested class.

Returns:

An object pointer of the given class on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public const T_As * RED::PostProcess::As() const

Template version of the as const method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to a const instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

template< class T_As > public T_As * RED::PostProcess::As()

Template version of the as method.

Simply set T to be the class you want to retrieve an interface to.

Returns:

A pointer to an instance of class T on success, NULL otherwise.

Reimplements: RED::Object::As.

public float RED::PostProcess::GetBlur() const

Gets the current blur values.

See RED::PostProcess::SetBlur for details.

Returns:

the blur intensity.

Gets the size of the kernel used during the blur operation.

Returns:

The size of the kernel used during the blur operation.
public float RED::PostProcess::GetBrightness() const

Gets the current image brightness modifier value.

See RED::PostProcess::SetBrightness for details.

Returns:

the brightness modification value.
public float RED::PostProcess::GetBurnFactor() const

Gets the percentage of burning in the tone-mapped images.

See RED::PostProcess::SetBurnFactor for details.

Returns:

the percentage of burning in the tone-mapped images.
public float RED::PostProcess::GetContrast() const

Gets the current image contrast modifier value.

See RED::PostProcess::SetContrast for details.

Returns:

the contrast modification value.
public RED_RC RED::PostProcess::GetCurve(RED::Vector< float > &oX,
RED::Vector< float > &oValue
)

Gets the curve to be applied to image colors.

See RED::PostProcess::SetCurve for details.

Parameters:

oX:reference to the returned list of curve sample x coordinates.
oValue:reference to the returned list of curve sample values.

Returns:

RED_OK on success,
RED_ALLOC_FAILURE on a memory allocation error,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Gets the curve ramp texture.

Parameters:

oRampA pointer to the curve ramp texture.

Returns:

RED_OK if the method has succeeded,
RED_ALLOC_FAILURE if a memory allocation has failed,
Any RED_DRV* error code if an error is returned by the GPU driver.
public void RED::PostProcess::GetDepthLine(float &oIntensity,
float &oDepth
)const

Gets the intensity and depth of the depth line effect.

Parameters:

oIntensity:returned intensity of the effect between 0 and 1.
oDepth:returned depth of the effect in scene unit.

Gets the color of the depth line effect.

Returns:

the color of the line effect.

Gets the width of the depth line effect.

Returns:

the width of the line in scene unit.
public void RED::PostProcess::GetDOF(float &oDOF,
float &oNearMin,
float &oNearMax,
float &oFarMin,
float &oFarMax
)const

Gets the current DOF values.

See RED::PostProcess::SetDOF for details.

Parameters:

oDOF:returned DOF intensity between 0 and 1.
oNearMin:distance from the camera where sharpness starts to increase.
oNearMax:distance from the camera where sharpness is maximum.
oFarMin:distance from the camera where sharpness starts to decrease.
oFarMax:distance from the camera where sharpness is minimum.

Gets the size of the kernel used during the DOF operation.

Returns:

The size of the kernel used during the DOF operation.
public float RED::PostProcess::GetExposure() const

Returns the exposure scaling factor.

See RED::PostProcess::SetExposure for details.

Returns:

the exposure scaling factor.
public float RED::PostProcess::GetGamma() const

Gets the current value for gamma correction.

See RED::PostProcess::SetGamma for details.

Returns:

the amount of gamma correction to be applied to input colors
public float RED::PostProcess::GetGlow() const

Gets the current glow value.

See RED::PostProcess::SetGlow for details.

Returns:

the glow intensity.

Gets the size of the kernel used during the glow operation.

Returns:

The size of the kernel used during the glow operation.

Gets the current glow threshold.

See RED::PostProcess::SetGlowThreshold for details.

Returns:

the glow threshold.
public void RED::PostProcess::GetHSL(float &oHue,
float &oSaturation,
float &oLightness
)const

Gets the current HSL effect value.

See RED::PostProcess::SetHSL for details.

Parameters:

oHue:Returned hue value.
oSaturation:Returned saturation value.
oLightness:Returned lightness value.
public float RED::PostProcess::GetKey() const

Retrieves the tonemapping key.

Returns:

The value of the tonemapping key used if the automatic key calculation is turned off.
public void RED::PostProcess::GetLevels(float &oInputBlack,
float &oInputWhite,
float &oOutputBlack,
float &oOutputWhite
)const

Gets the current greyscale levels parameters of the image.

See RED::PostProcess::SetLevels for details.

Parameters:

oInputBlack:Returned input black value.
oInputWhite:Returned input white value.
oOutputBlack:Returned output black value.
oOutputWhite:Returned output white value.
public void RED::PostProcess::GetLuminanceInformation(float &oAverageLuminance,
float &oLogAverageLuminance,
unsigned int &oSamplesCount,
float &oMinLuminance,
float &oMaxLuminance
)const

Retrieves last luminance informations available for the camera using this post process.

This method provides a direct access to the luminance informations that were calculated last during a GPU or during a CPU post-process operation. In both cases, valid luminance values can only be accessed after one draw with the post-process active. On the GPU, a RED::IWindow::FrameDrawing call must have occurred before luminance values can be retrieved through this method. Similarly, on the CPU, a RED::IWindow::FrameTracing (or similar call) must have occurred.

Due to the fact that the RED::PostProcess class is stateless, data returned by this method are set by the thread that calls the drawing method (the rendering thread). Accessing this method on another thread should be done carefully as there's no locked access here. Data is modified by the rendering thread whenever appropriate without notice.

The GI cache and tone mapping for panorama tutorial uses this function to get the luminance values.

Parameters:

oAverageLuminance:The average luminance value calculated last.
oLogAverageLuminance:The log value of the average luminance calculated last.
oSamplesCount:The number of samples for the calculation of the log average luminance.
oMinLuminance:The minimal luminance value calculated last.
oMaxLuminance:The maximal luminance value calculated last.
public void RED::PostProcess::GetLuminanceOverride(float &oAverageLuminance,
float &oLogAverageLuminance,
unsigned int &oSamplesCount,
float &oMinLuminance,
float &oMaxLuminance
)const

Returns overriden luminance parameters.

Parameters:

oAverageLuminance:The average luminance value.
oLogAverageLuminance:The log value of the average luminance in the image.
oSamplesCount:The number of samples for the calculation of the log average luminance.
oMinLuminance:The minimal luminance value in the image.
oMaxLuminance:The maximal luminance value in the image.
public void RED::PostProcess::GetLUT(RED::Vector< unsigned char > &oTable,
unsigned int &oSize
)const

Gets the current look up table.

See RED::PostProcess::SetLUT for details.

Parameters:

oTable:Returned array of color values.
oSize:Returned size of the cube.

Gets the default look up table as a RED::IImage3D.

See RED::PostProcess::SetLUT for details.

Parameters:

oImage3D:Pointer to the returned image. This image is created internally and therefore is owned by the RED::PostProcess class.

Returns:

RED_OK on success,
RED_FAIL otherwise.
public float RED::PostProcess::GetSharpen() const

Gets the current sharpening value.

See RED::PostProcess::SetSharpen for details.

Returns:

the sharpen intensity.

Gets the size of the kernel used during the sharpen operation.

Returns:

The size of the kernel used during the sharpen operation.

Gets the current tone mapping operator.

See RED::PostProcess::SetToneMapping method documentation for further details about tone mapping with REDsdk.

Returns:

the current tone mapping operator.
public float RED::PostProcess::GetVignette() const

Gets vignette effect intensity.

See RED::PostProcess::SetVignette for details.

Returns:

the effect intensity between 0 and 1.

Gets the vignette effect color.

See RED::PostProcess::SetVignetteColor for details.

Returns:

the effect color.

Gets the vignette effect roundness.

See RED::PostProcess::SetVignetteRoundness for details.

Returns:

the effect roundness between 0 and 1.

Gets the vignette effect size.

See RED::PostProcess::SetVignetteSize for details.

Returns:

the effect size between 0 and 1.

Gets the vignette effect smoothness.

See RED::PostProcess::SetVignetteSmoothness for details.

Returns:

the effect smoothness between 0 and 1.

Gets the current white reference value.

See RED::PostProcess::SetWhiteReference for details.

Returns:

the white color to be used as reference when applying white balance.

Do the brightness and contrast calculations use legacy formulas?

Returns:

true if we use the legacy formulas, false otherwise.
public bool RED::PostProcess::IsAutoKey() const

Retrieves the auto key flag.

Returns:

The auto key setup for the tonemapper.

Returns true if the color operations does not change the input color.

Color operations are:

  • brightness / contrast;
  • HSL modifications;
  • curve correction;
  • white balance;
  • levels;
  • gamma.

Returns:

true if the curve setup is neutral, false otherwise.

Returns true if the curve is neutral.

The post process operator is neutral if an input color is returned unchanged by a call to RED::PostProcess::Process, or by the equivalent GPU processing.

Returns:

true if the curve setup is neutral, false otherwise.

Are we overriding the rendered image luminance values?

Returns:

true if we have set a RED::PostProcess::OverrideLuminance, false if we don't override image luminance values.
public bool RED::PostProcess::IsNeutral() const

Returns true if the post process setup is neutral, false otherwise.

The post process operator is neutral if an input color is returned unchanged by a call to RED::PostProcess::Process, or by the equivalent GPU processing.

Returns:

true if the post process setup is neutral, false otherwise.

Loads a color look up table from a file.

See RED::PostProcess::SetLUT for details.

The method loads a .cube file and sets the color LUT to the RED::PostProcess.

The 3D table is a cube. Its size is the same in all dimensions.

Parameters:

iFilePath:Full path to the source file.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FILE_DATA_ERROR if the file can't be loaded properly,
RED_FAIL otherwise.

Copy operator.

Parameters:

iOther:reference to the object to copy from.

Returns:

RED_OK if the operation has succedede,
RED_ALLOC_FAILURE if a memory allocation has failed.
public RED_RC RED::PostProcess::OverrideLuminance(floatiAverageLuminance,
floatiLogAverageLuminance,
unsigned intiSamplesCount,
floatiMinLuminance,
floatiMaxLuminance
)

Overrides the luminance parameters of tonemapped images.

This method can be used to externally control the luminance of the tonemapped images. The default REDsdk behavior stores luminance informations on the color image being processed. Then, these luminance parameters are used by the tonemapper to process the image.

Using this method, luminance values are overriden, and image luminance parameters are ignored.

Refer to RED::IImage2D for the details on all luminance parameters.

The GI cache and tone mapping for panorama tutorial uses this function to set the tone mapping on all six faces of a cube.

Parameters:

iAverageLuminance:The new value for the average luminance.
iLogAverageLuminance:The log value of the average luminance in the image.
iSamplesCount:The number of samples for the calculation of the log average luminance.
iMinLuminance:The minimal luminance value in the image.
iMaxLuminance:The maximal luminance value in the image.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter.
public RED_RC RED::PostProcess::ProcessBlurPass1(floatoColor[4],
const float *iColorBuffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current blur value. First Pass.

see RED::PostProcess::SetBlur for details about blur.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly blur the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

The blur process is separated into two passes. Methods must be called in this order:

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessBlurPass2(floatoColor[4],
const float *iColorBuffer,
const float *iPass1Buffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current blur value. Second Pass.

see RED::PostProcess::SetBlur for details about blur.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly blur the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

The blur process is separated into two passes. Methods must be called in this order:

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iPass1Buffer:result buffer after calling RED::PostProcess::ProcessBlurPass1.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessColorOperations(floatoColor[4],
const floatiColor[4]
)

Processes a given color from a color buffer using the current color operations value.

The color operations are (executed in this order):

  • Brightness / contrast;
  • HSL;
  • Curve correction;
  • White balance;
  • Levels and gamma.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

Parameters:

oColor:processed color.
iColor:input color.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessDepthLine(floatoColor[4],
const floatiColor[4],
floatiDepth
)

Processes a given color from a color buffer using the depth line effect parameters.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

Parameters:

oColor:processed color.
iColor:color of the current pixel.
iDepth:depth value for the current pixel.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessDOFPass1(floatoColor[4],
const float *iColorBuffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current DOF value. First pass.

see RED::PostProcess::SetDOF for details about DOF.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly apply DOF to the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

The DOF process is separated into two passes. Methods must be called in this order:

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessDOFPass2(floatoColor[4],
const float *iColorBuffer,
const float *iPass1Buffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY,
floatiDepth
)

Processes a given color from a color buffer using the current DOF value. Second pass.

see RED::PostProcess::SetDOF for details about DOF.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly apply DOF to the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iPass1Buffer:result buffer after calling RED::PostProcess::ProcessDOFPass1.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.
iDepth:depth value for the current pixel.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessGlowPass1(floatoColor[4],
const float *iColorBuffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current glow value. First Pass.

see RED::PostProcess::SetGlow for details about the glow tool.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly apply glow to the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

The glow process is separated into three passes. Methods must be called in this order:

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessGlowPass2(floatoColor[4],
const float *iColorBuffer,
const float *iPass1Buffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current glow value. Second Pass.

see RED::PostProcess::SetGlow for details about the glow tool.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly apply glow to the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

The glow process is separated into three passes. Methods must be called in this order:

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iPass1Buffer:result buffer after calling RED::PostProcess::ProcessGlowPass1.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessGlowPass3(floatoColor[4],
const float *iColorBuffer,
const float *iPass2Buffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current glow value. Third Pass.

see RED::PostProcess::SetGlow for details about the glow tool.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly apply glow to the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

The glow process is separated into three passes. Methods must be called in this order:

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iPass2Buffer:result buffer after calling RED::PostProcess::ProcessGlowPass2.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessLUT(floatoColor[4],
const floatiColor[4]
)

Processes a given color from a color buffer using the current LUT.

see RED::PostProcess::SetLUT for details about LUT.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

Parameters:

oColor:processed color.
iColor:input color.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessSharpen(floatoColor[4],
const float *iColorBuffer,
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current sharpen value.

see RED::PostProcess::SetSharpen for details about the sharpen tool.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The oColor adress cannot be in the iColorBuffer buffer since a call to this function must be done for each pixel of the same source buffer in order to correctly sharpen the entire image.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

Parameters:

oColor:processed color.
iColorBuffer:input color buffer.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessToneMapping(floatoColor[4],
const floatiColor[4],
floatiAverageLuminance,
floatiLogAverageLuminance,
floatiMinLuminance,
floatiMaxLuminance
)

Processes a given color using the current tone mapping setup.

The input color must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

It's safe to have both oColor and iColor memory addresses equal. The output color has its components clamped between 0.0 and 1.0.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

To process high quality pixels encored in RED::FMT_FLOAT_RGBA_AA format, please use the RED::PostProcess::ProcessToneMappingAA method instead.

Parameters:

oColor:processed color.
iColor:input color to be processed.
iAverageLuminance:average luminance of all the pixels to be processed.
iLogAverageLuminance:log-average luminance of all the pixels to be processed.
iMinLuminance:minimum luminance amongst all the pixels to be processed.
iMaxLuminance:maximum luminance amongst all the pixels to be processed.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessToneMappingAA(floatoColor[4],
const doubleiColor[4],
floatiAverageLuminance,
floatiLogAverageLuminance,
floatiMinLuminance,
floatiMaxLuminance,
booliIgnoreBackground
)

Processes a given color using the current tone mapping setup.

The input color must be in RED::FMT_FLOAT_RGBA_AA format. The source pixel information in iColor is decoded, processed and the results are written to oColor. The resulting color is in simple floating point format (e.g. RED::FMT_FLOAT_RGBA).

The RED::FMT_FLOAT_RGBA_AA color stores several informations, including the contribution of the background color to the result. It's possible to apply the processing to this background color contribution or not, depending on the value of iBackgroundProcess.

To process a non anti-aliased color source, please use RED::PostProcess::Process instead of this method.

Parameters:

oColor:Resulting color after processing.
iColor:input RED::FMT_FLOAT_RGBA_AA color to be processed.
iAverageLuminance:average luminance of all the pixels to be processed.
iLogAverageLuminance:log-average luminance of all the pixels to be processed.
iMinLuminance:minimum luminance amongst all the pixels to be processed.
iMaxLuminance:maximum luminance amongst all the pixels to be processed.
iIgnoreBackground:Do we apply the processing the to the background part of iColor? if 'true', the background part of the source color is not processed.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::ProcessVignette(floatoColor[4],
const floatiColor[4],
intiWidth,
intiHeight,
intiIndexX,
intiIndexY
)

Processes a given color from a color buffer using the current vignette effect value.

see RED::PostProcess::SetVignette for details about vignette effect.

The color buffer must be in RED::FMT_FLOAT_RGBA format. The alpha component will be copied unchanged in the output color.

The processing is performed entirely by the CPU and should be preferred for off-line or init time processing of data.

Parameters:

oColor:processed color.
iColor:input color.
iWidth:width of the input color buffer.
iHeight:height of the input color buffer.
iIndexX:horizontal index of the current pixel in the input color buffer.
iIndexY:vertical index of the current pixel in the input color buffer.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Resets the post process object to its initial state.

In its initial state, a RED::PostProcess instance is neutral.

Returns:

RED_OK if the operation has succeeded,
RED_ALLOC_FAILURE if an internal allocation has failed,
Any RED_DRV* if a GPU driver error has occurred.

Resets the curve to be applied to image colors.

Returns:

RED_OK on success,
RED_ALLOC_FAILURE if a memory allocation fails,
Any RED_DRV* GPU driver error code in case of error.

Resets the luminance override.

Calling this method cancels any effect of a previous RED::PostProcess::OverrideLuminance call.

public void RED::PostProcess::SetAutoKey(booliAutoKey)

Enables or disables automatic calculation of the tonemapping key.

The key is the tonemapping factor used to rescale all intensities in the visible range. By default, the engine automatically sets the key based on the luminance measured in the image. If iAutoKey is set to false, the value of the key can be defined by RED::PostProcess::SetKey.

Parameters:

iAutoKey:Set it to 'true' (default) to have the engine calculate the key based on the image luminance, set it to 'false' to manually specify the key value to use.

Sets the blur intensity.

This function applies a gaussian blur filter on the final image.

The blur filter kernel size can be changed using RED::PostProcess::SetBlurKernelSize.

Parameters:

iBlur:blur intensity between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the size of the kernel used during the blur operation.

Parameters:

iSize:size of the kernel used during the blur operation.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.
public RED_RC RED::PostProcess::SetBrightness(floatiBrightness)

Sets the image brightness.

This post effect allows to increase (iBrightness > 0) or decrease (iBrightness < 0) the image brightness.

Parameters:

iBrightness:brightness value between -1 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the percentage of burning in the tone-mapped images.

In a tone-mapped image, pixel luminances have been transformed to the unit interval [0, 1] making feasible to best display it on any device. The pixels having the biggest luminance (Lmax) in the source image are mapped to pixels having luminance = 1 in the tone mapped image.

However, sometimes it is desirable to reproduce some kind of burning into the tone-mapped image. It's a way to reflect how some sensors can saturate (e.g the eye) under too bright light. This is the purpose of the burn factor which expresses how much of the range between [0, Lmax] will burn into the tone-mapped image.

It works as follows: pixels having their luminance in the [(1 - burn_factor) * Lmax, Lmax] range will be mapped to luminance = 1. Hence, when the burn factor is 0 (the default), only pixels with luminance = Lmax will be tone-mapped to 1. But if you increase the burn factor, pixels with less luminance will also be tone mapped to 1 (increasing the image burning effect).

The burn factor only applies to the RED::TMO_PHOTOGRAPHIC tonemapping mode.

Parameters:

iBurn:burn factor in [0, 1] (default is 0).

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetContrast(floatiContrast)

Sets the image contrast.

This post effect allows to increase (iContrast > 0) or decrease (iContrast < 0) the image contrast.

Parameters:

iContrast:contrast value between -1 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetCurve(const RED::Vector< float > &iX,
const RED::Vector< float > &iValue
)

Sets the curve to be applied to image colors.

A curve can be defined which transforms input intensity. This is a common and easy way to apply intensity corrections to a whole image. For example, a S-curve is efficient to increase image contrast by lowering low intensity values and boosting high ones.

The curve is set by passing curve samples. Each sample is made of its position along the x-axis as well as the curve value at that position. Both iX and iValue vector should be of equal size. No more than 65535 samples can be provided.

The curve is built back from the samples using Lagrange polynomials for interpolation.

To reset the curve to a neutral curve (a straight line), simply call the SetCurve method passing (0,0) and (1,1) as curve samples or call RED::PostProcess::ResetCurve.

Parameters:

iX:position of the value along the x-axis of the curve.
iValue:value of the curve at the corresponding x coordinate.

Returns:

RED_OK on success,
RED_BAD_PARAM if there are less than two curve positions in iX and iValue or if numerical values are incorrect,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetDepthLine(floatiIntensity,
floatiDepth
)

Sets the depth line effect intensity and depth.

This effect highlights a given depth value from the viewpoint. It is mostly use as a debug tool to visualize the depth values of a scene.

The highlight size and color can be set using RED::PostProcess::SetDepthLineWidth and RED::PostProcess::SetDepthLineColor.

Parameters:

iIntensity:intensity of the post process between 0 and 1.
iDepth:depth at which the line is displayed.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.

Sets the color of the depth line effect.

Parameters:

iColor:color of the line effect.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.

Sets the width of the depth line effect.

Parameters:

iWidth:width of the line effect in scene unit.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.
public RED_RC RED::PostProcess::SetDOF(floatiDOF,
floatiNearMin,
floatiNearMax,
floatiFarMin,
floatiFarMax
)

Sets the DOF effect.

Depth Of Field is a post effect giving focus on a given distance and blurring the near and far regions, simulating the properties of real camera lenses.

The DOF filter kernel size can be changed using RED::PostProcess::SetDOFKernelSize.

iNearMin and iNearMax parameters defines the out-of-focus near-camera region whereas iFarMin and iFarMax parameters defines the out-of-focus far-camera region.

Depth of field parameters

All the parameters values should be between near and far viewpoint distances. see RED::IViewpoint::SetNearFar.

Parameters:

iDOF:DOF intensity between 0 and 1.
iNearMin:distance from the camera where sharpness starts to increase.
iNearMax:distance from the camera where sharpness is maximum.
iFarMin:distance from the camera where sharpness starts to decrease.
iFarMax:distance from the camera where sharpness is minimum.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the size of the kernel used during the DOF operation.

Parameters:

iSize:size of the kernel used during the DOF operation.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.
public RED_RC RED::PostProcess::SetExposure(floatiExposure)

Sets the exposure scaling factor to be applied to the processed image.

The exposure is a multiplicative term applied to the colors of processed image during tone mapping. Hence, tone mapping needs to be turned on for the exposure to be taken into account.

Increase the exposure to light up your tone mapped image, or decrease it if you want to make it darker.

Parameters:

iExposure:exposure in [0, +inf[ (default is 1.0).

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the gamma value for image gamma correction.

Due to the non-linear response of the monitors, gamma correction may need to be applied to image prior to displaying them onto the screen.

Gamma correction is applied as follows:

  output_color = input_color ^ (1.0 / gamma)

Parameters:

iGamma:amount of correction to be applied to input colors (should be in the [0, inf[ range).

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the glow intensity.

Glow is a post process increasing the white areas intensity in the image.

The glow filter kernel size can be changed using RED::PostProcess::SetGlowKernelSize.

Parameters:

iGlow:glow intensity between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the size of the kernel used during the glow operation.

Parameters:

iSize:size of the kernel used during the glow operation.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.

Sets the glow threshold.

See RED::PostProcess::SetGlow for details.

The glow threshold defines the luminance over which a pixel is enhanced.

Parameters:

iThreshold:glow threshold between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetHSL(floatiHue,
floatiSaturation,
floatiLightness
)

Modifies the HSL values of the image.

HSL is an alternative color space to RGB. It is a cylindrical-coordinate representation of color points.

Hue Saturation Lightness color space

This post effect allows to modify the Hue, Saturation and Lightness values of the image.

Parameters:

iHue:Hue value between -1 and 1.
iSaturation:Saturation value between -1 and 1.
iLightness:Lightness value between -1 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Defines the tonemapping key.

This method will have an effect only if the automatic key calculation is turned off using RED::PostProcess::SetAutoKey( false ). It lets the user specify the value of the key to use for the tonemapping.

The default key value is 1.0.

Parameters:

iKey:The new key value.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter.

Specifies if brightness and contrast calculations use legacy formulas.

Parameters:

iLegacy:do we use legacy formulas?

Returns:

RED_OK on success,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetLevels(floatiInputBlack,
floatiInputWhite,
floatiOutputBlack,
floatiOutputWhite
)

Modifies the image intensity levels.

Intensity levels allows to adjust the tonal range and color balance of the image.

Input black and white parameters remap the image intensities between these two boundaries. It clamps the values outside of the range and stretch the histogram inside of the range. Default values are 0 for black and 1 for white.

Note:

Input black parameter cannot be greater than input white parameter.

Output black and white parameters remap the input range between these two boundaries. By moving output black toward 1, the black parts of the final image will become greyish. Inverting output black and white values will result in a full color inversion. Default values are 0 for black and 1 for white.

Photoshop levels adjustment tool

Parameters:

iInputBlack:Input black value between 0 and 1.
iInputWhite:Input white value between 0 and 1.
iOutputBlack:Output black value between 0 and 1.
iOutputWhite:Output white value between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetLuminanceInformation(floatiAverageLuminance,
floatiLogAverageLuminance,
unsigned intiSamplesCount,
floatiMinLuminance,
floatiMaxLuminance
)const

Writes luminance informations.

Write the luminance values leveraged by RED::PostProcess::GetLuminanceInfo.

Parameters:

iAverageLuminance:The new value for the average luminance information.
iLogAverageLuminance:The log value of the average luminance information.
iSamplesCount:The number of samples for the calculation of the log average luminance.
iMinLuminance:The minimal luminance value information.
iMaxLuminance:The maximal luminance value information.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter.
public RED_RC RED::PostProcess::SetLUT(const RED::Vector< unsigned char > &iTable,
unsigned intiSize
)

Sets a 3D color look up table.

3D LUTs is a table of values that apply a color transform to an image.

The array iTable must be of size iSize^3 * 3. It stores Red, Green and Blue values for a cube of size iSize.

Red, green and blue goes from 0 to 255 along the first, second and third coordinates of the cube.

N being the size of the color cube, the memory index is r + N * g + N * N * b where r, g, b are the red, green and blue indices in the range 0 to N-1.

Default color cube (no effect) vs. color cube with a Sepia filter

Parameters:

iTable:Array of color values.
iSize:Size of the cube.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetSharpen(floatiSharpen)

Sets the sharpen intensity.

Sharpen is a post process enhancing the definition of edges in the image.

The sharpen filter kernel size can be changed using RED::PostProcess::SetSharpenKernelSize.

Parameters:

iSharpen:sharpen intensity between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the size of the kernel used during the sharpen operation.

Parameters:

iSize:size of the kernel used during the sharpen operation.

Returns:

RED_OK if the method has succeeded,
RED_BAD_PARAM if iSize is lower than 3 or higher than 10000.

Sets the tone mapping operator to be applied.

HDR images need to be processed in order to be displayed onto a screen. By default, REDsdk uses clamping (RED::TMO_CLAMP) to constrain colors to be in the displayable range. But this operator does not preserve local image properties (like contrast) and does not account for human visual system specificities.

This method lets you choose among available tone mapping operators the one that best fill your image reproduction requirements.

Here are some explanations about each mode:

  • RED::TMO_CLAMP: the default mode; simply clamps values outside from [0, 1].
  • RED::TMO_PHOTOGRAPHIC: always gives a correctly exposed image by default, but sometimes, at the price of un-natural amplifications of dark areas (the darkest areas of the image look over-exposed). The purpose of this method is to give good results in any situation.
  • RED::TMO_NEUTRAL: does nothing.
  • RED::TMO_EXPOSURE: multiply the input color by a single scalar value. The user has to set the value manually, either to something greater than one (to increase light exposition) or smaller than one (to reduce light exposition) to get the expected image.
  • RED::TMO_EXPONENTIAL: Applies a color correction based on the average luminance in an image.

Each mode may use some informations gathered from the image or not:

task

Task: Enabling tone mapping

RED::IViewpoint* iviewpoint = viewpoint->As< RED::IViewpoint >();
RED::PostProcess& pp = iviewpoint->GetPostProcessSettings();

RC_TEST( pp.SetToneMapping( RED::TMO_PHOTOGRAPHIC ) );

All tone mapping controls are available on the RED::PostProcess class instance of the viewpoint. Please note that the RED::PostProcess class is accessed directly, without any RED::State transaction parameter. Consequently, changing the tone mapper settings should only occur from the rendering thread, before or after a rendering call. This lets the calling application dynamically change the tone mapping of an image while its calculated.

Parameters:

iToneMappingOperatorThe tone mapping operator to be applied to the image.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.
public RED_RC RED::PostProcess::SetVignette(floatiIntensity)

Sets a vignette around the image.

A vignette around the screen.

Multiple parameters are available:

Parameters:

iIntensity:Intensity of the vignette effect between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the color of the vignette effect.

Parameters:

iColor:Color of the vignette.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the roundness of the vignette effect.

Parameters:

iRoundness:Roundness of the effect between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the size of the vignette effect.

The vignette size iSize is between 0 and 1 from no vignette to a full screen vignette.

Parameters:

iSize:Size of the effect between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the smoothness of the vignette effect.

The vignette smoothness iSmoothness is between 0 and 1 from hard edge to full screen fade.

Parameters:

iSmoothness:Smoothness of the effect between 0 and 1.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Sets the white color to be used as reference when applying white balance.

Color balance is needed to compensate for un-natural looking of images rendered under some conditions. For example, an indoor scene by night lit only by artificial light sources may look too yellow. At the opposite, an outdoor scene may look too much blue.

A kind of auto white balance (as provided by consumer cameras) can be achieved by passing the average image color to SetWhiteReference.

If not, the input color components are clamped to the [0,1] interval.

Parameters:

iWhite:white reference.

Returns:

RED_OK on success,
RED_BAD_PARAM on an invalid input parameter,
RED_FAIL otherwise.

Intializes the curve ramp texture used by both CPU & GPU post-processing shaders.

Returns:

RED_OK on success,
RED_ALLOC_FAILURE on a memory allocation error,
RED_FAIL otherwise.

Intializes the color LUT texture used by GPU post-processing shaders.

Returns:

RED_OK on success,
RED_ALLOC_FAILURE on a memory allocation error,
RED_FAIL otherwise.

Resets the internal color LUT image.

If the image has not been already created, the method does nothing. Otherwise, it fills the image with default LUT data of size 2^3.

Returns:

RED_OK on success,
RED_FAIL otherwise.

Variables documentation

Is automatic key calculation enabled?

protected float RED::PostProcess::_blur

Blur intensity.

Blur kernel size.

Brightness modifier value.

protected float RED::PostProcess::_burn

Image burn factor (for tone mapping only).

Color balance multiplier (from white reference).

Contrast modifier value.

List of the curve samples.

Single channel texture storing the curve values.

Depth line effect intensity.

Depth line color.

Depth line depth.

Depth line width.

protected float RED::PostProcess::_dof

DOF intensity.

DOF far max distance.

DOF far min distance.

DOF kernel size.

DOF near max distance.

DOF near min distance.

Image exposure scaling factor (for tone mapping only).

protected float RED::PostProcess::_gamma

Current gamma correction value.

protected float RED::PostProcess::_glow

Glow intensity.

Glow kernel size.

Glow threshold.

protected float RED::PostProcess::_hue

Hue modifier.

Average luminance information.

Log of the average luminance information.

Maximal luminance information.

Minimal luminance information.

Number of luminance samples information.

protected float RED::PostProcess::_key

Tonemapper key to use if automatic key calculation is turned off.

Do we use legacy brightness / contrast?

Levels input black.

Levels input white.

Levels output black.

Levels output white.

Lightness modifier.

Average luminance.

Are we overriding the rendered image luminance values?

Log of the average luminance.

Maximal luminance.

Minimal luminance.

Number of luminance samples.

protected RED::Vector< unsigned char > RED::PostProcess::_lut

Color lut.

protected unsigned int RED::PostProcess::_lut_size

Color lut cube size.

Color lut 3D image.

Pointer to the resource manager.

Saturation modifier.

Sharpen intensity.

Sharpen kernel size.

Current tone mapping operator.

Vignette intensity.

Vignette color.

Vignette roundness.

Vignette size.

Vignette smoothness.

White reference.