Click or drag to resize
DigitalRuneColorCorrectionFilter Class
Modifies an image using a color lookup table (a.k.a. "color grading").
Inheritance Hierarchy
SystemObject
  DigitalRune.Graphics.PostProcessingPostProcessor
    DigitalRune.Graphics.PostProcessingColorCorrectionFilter

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

The ColorCorrectionFilter type exposes the following members.

Constructors
  NameDescription
Public methodColorCorrectionFilter
Initializes a new instance of the ColorCorrectionFilter class.
Top
Methods
  NameDescription
Public methodStatic memberConvertLookupTexture
Converts a 2D lookup texture to a 3D lookup texture.
Public methodStatic memberCreateLookupTexture2D(GraphicsDevice)
Creates the default 2D lookup texture (no color transformations) with 16 entries per color channel.
Public methodStatic memberCreateLookupTexture2D(GraphicsDevice, Int32)
Creates the default 2D lookup texture (no color transformations) with the specified lookup table size.
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.
(Overrides PostProcessorDispose(Boolean).)
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 methodSetLookupTexture Obsolete.
Sets the 3D lookup texture (LookupTextureA). (Overwrites the existing 3D lookup texture.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyDefaultTargetFormat
Gets or sets the default target format. (This property is used by the PostProcessorChain).
(Inherited from PostProcessor.)
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 propertyInterpolationParameter
Gets or sets the interpolation parameter for interpolating between the result of LookupTextureA and LookupTextureB.
Public propertyIsDisposed
Gets a value indicating whether this post-processor has been disposed of.
(Inherited from PostProcessor.)
Public propertyLookupTexture Obsolete.
Gets or sets the primary color lookup texture (a 3D texture). Same as LookupTextureA.
Public propertyLookupTextureA
Gets or sets the primary color lookup texture (a 3D texture).
Public propertyLookupTextureB
Gets or sets a secondary, optional color lookup texture (a 3D texture).
Public propertyName
Gets or sets the name of the post-processor.
(Inherited from PostProcessor.)
Public propertyStrength
Gets or sets the strength of the effect.
Top
Remarks

This processor uses a 3D volume texture as a color lookup table to transform the colors of an image. LookupTextureA can be set directly. But it is usually easier to load it from a 2D texture. The method CreateLookupTexture2D(GraphicsDevice) creates a default 2D lookup texture (without any color transformations). Use ConvertLookupTexture(Texture2D) to convert a 2D lookup texture to a 3D lookup texture.

Workflow:
To define a color lookup texture, the artist can use following steps:

  1. Make a screenshot of the game and load it in Photoshop.
  2. Load the default lookup texture in Photoshop.
  3. Copy the lookup texture in Photoshop and paste it into the document with the screenshot.
  4. Apply color manipulations to the screenshot and the lookup texture. (Usually using adjustment layers.)
  5. Select the lookup table inside the screenshot. (Select the layer with the lookup table and use the menu Select | Load Selection.)
  6. Select the menu Edit | Copy Merged to select the lookup table including the adjustments.
  7. Paste the lookup texture into a new image and save it.

(Of course the color lookup texture can also be created in any other image editing tool.)

Interpolation between lookup textures:
Optionally, you can set a second lookup texture in LookupTextureB and use InterpolationParameter to interpolate between both. This can be used to gradually change the color correction when transitioning to a new zone in the game level. If only LookupTextureA or LookupTextureB is set, then one lookup texture is applied with the specified Strength and InterpolationParameter is ignored.

See Also