Line | |
---|
1 | sampler indirectTexture: register(s0);
|
---|
2 | sampler sourceTexture: register(s1);
|
---|
3 |
|
---|
4 | uniform float epsilonX;
|
---|
5 | uniform float epsilonY;
|
---|
6 | uniform float sourceTextureSize;
|
---|
7 | uniform float numSamples;
|
---|
8 | uniform float sqrtNumSamples;
|
---|
9 | uniform float3 ambientColor;
|
---|
10 | uniform float ambient;
|
---|
11 |
|
---|
12 | float4 main_fp(float2 texCoord: TEXCOORD0,
|
---|
13 | float2 subTexCoord: TEXCOORD1,
|
---|
14 | float diffuseIn : TEXCOORD2) : COLOR
|
---|
15 | {
|
---|
16 | float4 ocolor = float4(0.0, 0.0, 0.0, 0.0);
|
---|
17 | float2 epsilon = float2(epsilonX, epsilonY);
|
---|
18 | float4 value = tex2D(indirectTexture, subTexCoord).xyzw;
|
---|
19 | float2 coords = float2(0.0, 1.0) - abs(texCoord - ( value.xy - epsilon ) );
|
---|
20 |
|
---|
21 | if (value.w != 0.0)
|
---|
22 | {
|
---|
23 | float2 newcoord = (float2(1.0, 1.0) - value.zw) + ((coords * sourceTextureSize) / sqrtNumSamples);
|
---|
24 | ocolor = float4(tex2D(sourceTexture, newcoord).xyzw);
|
---|
25 | ocolor.xyz = (ambientColor * ambient * 0.000001) + (ocolor.xyz * diffuseIn);
|
---|
26 | }
|
---|
27 |
|
---|
28 | return ocolor;
|
---|
29 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.