Graphics Reference
In-Depth Information
out vec4 fFragColor;
void main( )
{
vec3 brgb = texture( uBeforeUnit, vST ).rgb;
vec3 argb = texture( uAfterUnit, vST ).rgb;
vec3 color;
vec4 nv = texture(Noise3, vMCposition/10.);
float sum = nv.r + nv.g + nv.b + nv.a;
sum = ( sum - 1. ) / 2.; // 0. to 1.
sum = fract( sum );
if ( sum < uT )
color = argb;
else
color = brgb;
fFragColor = vec4( color, 1.);
}
Although we do not save it for any other use, this
numeric value sum actually provides a noise texture that
acts as the controller for the transition; if we set
color = vec3( sum, sum, sum );
instead of seting color in the if statement, we can see that
texture, shown in Figure 11.33.
There are obviously many other ways you could con-
trol which image contributes the actual value for any pixel.
For example, almost any of the image blending operations
that involves taking part of one image and part of another
image under control of a parameter could be used to create
a transition by varying that parameter. Further develop-
ments are left for the curious reader.
Figure 11.33. The grayscale texture
used in the break-through transition.
Notes
These sections have discussed a number of techniques that are all rather simi-
lar, but that differ in how an image is processed on its own, is compared with
a reference image, or is combined with a different image. The techniques are
Search WWH ::




Custom Search