Graphics Reference
In-Depth Information
Dissolve
The
image dissolve
operation computes a weighted aver-
age of the
Before
and
After
images that determines how
much of each image's color is used in the output image.
This weight can be given by a parameter that changes
over time, giving the effect of moving from one image
to another, as can be done for slideshows. This is shown
in Figure 11.30 and in the weighted-average fragment
shader code below. As the value of
uT
ranges from 0. to
1., the
Before
image dissolves into the
After
image.
uniform sampler2D uBeforeUnit, uAfterUnit;
uniform float uT;
Figure 11.30.
A dissolve of the two
sample images with
uT
= 0.5.
in vec2 vST;
out vec4 fFragColor;
void main( )
{
vec3 brgb = texture( uBeforeUnit, vST ).rgb;
vec3 argb = texture( uAfterUnit, vST ).rgb;
fFragColor = vec4( mix( argb, brgb, uT ), 1. );
}
Burn-Through
Another transition can be made where the
After
image
“burns through” the
Before
image; that is, where the
parts of the
After
image with the strongest luminance
replace the same parts of the
Before
image. We will
leave this exact transition for the exercises, but we
will consider an example where we approximate the
luminance by the average of the R, G, and B colors in
the
After
image. The effect of this transition is almost
like the
After
image burning through the
Before
image,
which is why we have chosen this name for it. In
Figure 11.31 we see this transition partway through. It
is not difficult to see some of the darker architectural
features of the village scene coming through the cher-
ries image.
Figure 11.31.
The Hong village
image burning through the cherry
blossom image.