Graphics Reference
In-Depth Information
Making Information Visible Through Motion
We have seen many examples of shader programming being used to create
effective graphics that communicate information to the user using various geo-
metric methods. However, it may be interesting to think about using graph-
ics to make information visible through motion rather than geometry. Dan
Sandin explored this concept as long ago as the late 1980s [40] and computer
graphics shaders give us beter tools to illustrate this. Sample shader functions
to do this are given below.
The vertex shader is simple, merely copying the atribute values of vertex
location (in model space) and texture coordinates to output variables that are
then available to the fragment shader, and seting the global gl_Position vari-
able. This is standard but is included for completeness.
out vec3 vMCposition;
out vec2 vST;
void main( )
{
vMCposition = aVertex.xyz;
vST = aTexCoord0.st;
gl_Position = uModelViewProjectionMatrix * aVertex;
}
The fragment shader reads in two textures, a white noise texture and
a mask texture, and moves pixels from the white noise texture either left or
right depending on the value in the mask texture. This motion difference lets
you distinguish areas in the mask texture so you can get information from the
mask through motion in the white noise. Just what kind of information can be
distinguished remains an open research question, and we suggest some explo-
rations in this area in one of this chapter's exercises.
uniform sampler2D uRandomUnit, uMaskUnit;
uniform float Timer; // from glman
in vec3 vMCposition;
in vec2 vST;
out vec4 fFragColor;
void main( )
{
vec2 st = vST;
Search WWH ::




Custom Search