-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathab.flowrepos.jxs
executable file
·50 lines (45 loc) · 1.47 KB
/
ab.flowrepos.jxs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<jittershader name="flowrepos">
<description>
high-quality relative distortion based on hsflow output position map
</description>
<param name="amt" type="vec2" default="1. 1." />
<param name="scale" type="vec4" default="1. 1. 1. 1." />
<param name="bias" type="vec4" default="0. 0. 0. 0." />
<param name="tex0" type="int" default="0" />
<param name="tex1" type="int" default="1" />
<language name="glsl" version="1.0">
<bind param="amt" program="fp" />
<bind param="scale" program="fp" />
<bind param="bias" program="fp" />
<bind param="tex0" program="fp" />
<bind param="tex1" program="fp" />
<program name="vp" type="vertex" source="sh.passthrudim.vp.glsl" />
<program name="fp" type="fragment">
<![CDATA[
// Andrew Benson - andrewb@cycling74.com
// Copyright 2009
//setup for 2 texture
varying vec2 texcoord0;
varying vec2 texcoord1;
varying vec2 texdim0;
varying vec2 texdim1;
uniform vec2 amt;
uniform vec4 scale;
uniform vec4 bias;
uniform vec2 boundmode;
uniform sampler2DRect tex0;
uniform sampler2DRect tex1;
void main()
{
vec4 look = texture2DRect(tex1,texcoord1);//sample repos texture
vec2 offs = vec2(look.y-look.x,look.w-look.z)*amt;
vec2 coord = offs+texcoord0;//relative coordinates
//coord = mod(coord,texdim0);
vec4 repos = texture2DRect(tex0, coord);
// output texture
gl_FragColor = repos*scale+bias;
}
]]>
</program>
</language>
</jittershader>