Click or drag to resize
DigitalRuneHdrFilter Class
Performs HDR tone mapping supporting bloom/glare, dynamic eye adaption and scotopic vision.
Inheritance Hierarchy

Namespace: DigitalRune.Graphics.PostProcessing
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public class HdrFilter : PostProcessor

The HdrFilter type exposes the following members.

Constructors
  NameDescription
Public methodHdrFilter
Initializes a new instance of the HdrFilter class.
Top
Methods
  NameDescription
Public methodDispose
Releases all resources used by an instance of the PostProcessor class.
(Inherited from PostProcessor.)
Protected methodDispose(Boolean)
Releases the unmanaged resources used by an instance of the PostProcessor class and optionally releases the managed resources.
(Inherited from PostProcessor.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnDisable
Called when this post-processor is disabled.
(Inherited from PostProcessor.)
Protected methodOnEnable
Called when this post-processor is enabled.
(Inherited from PostProcessor.)
Protected methodOnProcess
Called when the post-processor should perform the post-processing.
(Overrides PostProcessorOnProcess(RenderContext).)
Public methodProcess
Performs the post-processing using the SourceTexture and the RenderTarget specified in the render context.
(Inherited from PostProcessor.)
Public methodReset Obsolete.
Resets the dynamic internal states, especially dynamic luminance adaption.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyAdaptionSpeed
Gets or sets the adaption speed of the eye.
Public propertyBloomIntensity
Gets or sets the bloom intensity factor.
Public propertyBloomThreshold
Gets or sets the brightness threshold.
Public propertyBlueShiftCenter
Gets or sets scene luminance where 50% blue shift is applied
Public propertyBlueShiftColor
Gets or sets the color of the blue shift.
Public propertyBlueShiftRange
Gets or sets the range of the blue shift.
Public propertyDefaultTargetFormat
Gets or sets the default target format. (This property is used by the PostProcessorChain).
(Inherited from PostProcessor.)
Public propertyDownsampleFactor
Gets or sets the downsample factor.
Public propertyEnableBlueShift
Gets or sets a value indicating whether a blue shift is applied to scenes with low average luminance.
Public propertyEnabled
Gets or sets a value indicating whether this post-processor is enabled.
(Inherited from PostProcessor.)
Public propertyGraphicsService
Gets the graphics service.
(Inherited from PostProcessor.)
Public propertyIsDisposed
Gets a value indicating whether this post-processor has been disposed of.
(Inherited from PostProcessor.)
Public propertyMaxExposure
Gets or sets the max exposure factor.
Public propertyMiddleGray
Gets or sets the average gray level.
Public propertyMinExposure
Gets or sets the min exposure factor.
Public propertyName
Gets or sets the name of the post-processor.
(Inherited from PostProcessor.)
Public propertyUseAdaption
Gets or sets a value indicating whether dynamic eye adaption should be used.
Public propertyUseGeometricMean
Gets or sets a value indicating whether the average luminance is computed using the geometric mean.
Top
Remarks

This post-processor is also responsible for converting the input texture from an HDR format (usually HdrBlendable) to an LDR format. Therefore, the surface format in DefaultTargetFormat is set to Color.

This post-processor stores luminance information of a frame for use in the next frame. The information is stored with the currently active camera node. When there is a cut in the scene (i.e. a new level is loaded or the view changes significantly), the method InvalidateViewDependentData of the camera node needs to be called to reset the luminance information. Further, this post-processor expects that it is called once per frame for a certain camera node. It might not work as expected if it is called several times per frame (e.g. to process different views using the same camera).

Exposure and Middle Gray
The HdrFilter computes the average brightness of the scene and applies a brightness scale factor ("exposure") so that the average brightness of the final image is equal to MiddleGray. That means, if you are in a dark cave, the filter will make the image a lot brighter. If you are in a white dessert, it will make the image darker. Both images will have the same average brightness defined by MiddleGray. The brightness scale factor is limited by MinExposure and MaxExposure. That means, if you set MinExposure = MaxExposure = 1, then there will be no brightness change. If your scene is very bright or very dark, then you have to adjust MiddleGray. Use MinExposure and MaxExposure to limit the allowed brightness changes.

Night Tone mapping with Blue Shift (Scotopic Vision):
The human visual system perceives low luminance scenes (e.g. night scenes) different than well-lit scenes. Under daylight the cones in the human eye dominate and create the normal color image (photopic vision). The cones start to lose sensitivity at about 3.4 cd/m², and the rods start to get more dominant. A dark scene perceived by the rods (scotopic vision) is monochrome with a blue shift. This HdrFilter supports physically-based night tone mapping. Per default it is disabled. The blue shift is controlled using the properties EnableBlueShift, BlueShiftColor, BlueShiftCenter and BlueShiftRange. Depending on the lighting in the scene, BlueShiftColor might need to be scaled. It is also possible to use a different color for a more dramatic effect. BlueShiftCenter and BlueShiftRange might also need to be changed if the scene is not lit using physically-based light intensities and lighting models.

See Also