Line | |
---|
1 | uniform sampler2D indirectTexture;
|
---|
2 | uniform sampler2D sourceTexture;
|
---|
3 | uniform float epsilonX;
|
---|
4 | uniform float epsilonY;
|
---|
5 | uniform float sourceTextureSize;
|
---|
6 | uniform float numSamples;
|
---|
7 | uniform float sqrtNumSamples;
|
---|
8 |
|
---|
9 | void main(void)
|
---|
10 | {
|
---|
11 | vec4 ocolor = vec4(0.0, 0.0, 0.0, 0.0);
|
---|
12 | vec2 epsilon = vec2(epsilonX, epsilonY);
|
---|
13 | vec2 texCoord = gl_TexCoord[0].xy;
|
---|
14 | vec2 subTexCoord = gl_TexCoord[1].xy;
|
---|
15 | vec4 value = texture2D(indirectTexture, subTexCoord).xyzw;
|
---|
16 | vec2 coords = vec2(0.0, 1.0) - abs(texCoord - ( value.xy - epsilon ) );
|
---|
17 |
|
---|
18 | if (value.z != 0.0)
|
---|
19 | {
|
---|
20 | vec2 newcoord = (vec2(1.0, 1.0) - value.zw) + ((coords * sourceTextureSize) / sqrtNumSamples);
|
---|
21 | ocolor = vec4(texture2D(sourceTexture, newcoord).xyzw);
|
---|
22 | }
|
---|
23 | gl_FragColor = ocolor;
|
---|
24 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.