qcMSAQuadWarper (2008)

The main magic happens in the GLSL shader below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
uniform vec2 BL, BR, TL, TR;
uniform vec2 renderSize;

void main() {
// transform from QC object coords to 0...1
vec2 p = (vec2(gl_Vertex.x, gl_Vertex.y) + 1.) * 0.5;

// interpolate bottom edge x coordinate
vec2 x1 = mix(BL, BR, p.x);

// interpolate top edge x coordinate
vec2 x2 = mix(TL, TR, p.x);

// interpolate y position
p = mix(x1, x2, p.y);

// transform from 0...1 to QC screen coords
p = (p - 0.5) * renderSize;

gl_Position = gl_ModelViewProjectionMatrix * vec4(p, 0, 1);
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
}

GLSL Shader to do Quad Warping, and map textures to surfaces.

Created as a Quartz Composer patch which allows it to be used as a plugin for any QC compatible host. In the videos included here, the plugin is demonstrated in VDMX.

Download

msa_Quad Warp.qtz

License

Released under theĀ MIT License

Acknowledgements

Paul Heckbert’s Masters Thesis -
Fundamentals of Texture Mapping and Image Warping.

The projection mapping tutorial demo (VDMX + Quartz Composer) is inspired by deepvisual’s modul8 demo
youtube.com/watch?v=2bRfdn9lNO8