Graphics Reference
In-Depth Information
float3 target = float3(0,0,0);
output[dispatchThreadId.xy] = lerpKeepAlpha(target, sample,
LerpT);
4.
The output of the contrast and brightness is shown in the following screenshot
(Top (left to right): contrast 1.40, 0.6, -1.0 (negative); Bottom (left to right):
brightness 0.70, 1.0 (original image), 1.4):
Top (left to right): contrast 1.40, 0.6, -1.0 (negative); Bottom (left to right): brightness 0.70, 1.0 (original image), 1.4
How it works…
Through the process of linear interpolation, we are able to add or remove levels of gray and
black from the source image. By extrapolating the lerp, we are able to extend the effect past
the standard 0-1 range.
We control the time ( t ) component of the lerp by updating a constant buffer that has been
bound to the compute shader pipeline stage. To maintain the correct alpha for the initial
sample, we exclude this component from the lerp, and add two helper functions to simplify
the code.
Try experimenting with different LerpT values and different constants for the color that is
being added/removed.
There's more…
Through a similar process as shown here, we can now perform any number of color
manipulations within the compute shader.
 
Search WWH ::




Custom Search