Graphics Reference
In-Depth Information
uniform sampler2D uImageUnit;
uniform float uT;
uniform sampler3D Noise3;
in vec3 vMCposition;
in vec2 vST;
out vec4 fFragColor;
void main( )
{
vec2 st = vST;
float x = st.x;
float y = st.y; // extract coordinates
vec4 noisevecx = texture( Noise3, vMCposition );
vec4 noisevecy = texture( Noise3,
vMCposition+vec3(noisevecx) );
x += uT*(noisevecx[.r]-noisevecx[.g]+noisevecx[.b]
+noisevecx[.a]-1.);
y += uT*(noisevecy[.r]-noisevecy[.g]+noisevecy[.b]
+noisevecy[.a]+1.);
st = vec2( x, y ); // restore coordinates
vec3 irgb = texture( uImageUnit, st ).rgb;
fFragColor = vec4( irgb, 1. );
}
You can also see image morphing , the transition over time from one
image to another, as a combination of image warping and image blending.
The image blending part of this is discussed in the sections below, while the
image warping for morphing is a very specialized process where a fixed set
of points on one image are mapped to a fixed set in another, and the image
blending is parameterized so that at the beginning, the geometry of one
image is fixed, and at the end, the geometry of the second image is achieved.
This is well beyond the scope of our discussion here, however; you can read
more in [46].
The Image Blending Process
There are several kinds of image manipulation in which you create a linear
combination of the pixels from one image with those from a constant or from
another image. This kind of combination is shown in Figure 11.19. In the next
few sections, the base value will be a constant color or a value derived directly
from each pixel, so only the image being manipulated is used. Later in this
Search WWH ::




Custom Search