source: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/media/general/indirectTexturingDefault_glsl_FP20.shd @ 864

Revision 864, 779 bytes checked in by igarcia, 18 years ago (diff)
RevLine 
[821]1uniform sampler2D indirectTexture;
2uniform sampler2D sourceTexture;
3uniform float epsilonX;
4uniform float epsilonY;
5uniform float sourceTextureSize;
[861]6uniform float numSamples;
7uniform float sqrtNumSamples;
[821]8
9void 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;   
[861]15   vec4 value = texture2D(indirectTexture, subTexCoord).xyzw;
16   vec2 coords = vec2(0.0, 1.0) - abs(texCoord - ( value.xy - epsilon ) );
[821]17
[861]18   if (value.z != 0.0)
[821]19   {       
[864]20        vec2 newcoord = (vec2(1.0, 1.0) - value.zw) + ((coords * sourceTextureSize) / sqrtNumSamples);
[861]21        ocolor = vec4(texture2D(sourceTexture, newcoord).xyzw);
[821]22   }
23   gl_FragColor = ocolor;
24}   
Note: See TracBrowser for help on using the repository browser.