hlsl代码为:
1 float2 ScreenMult = 1; 2 int TexIndex = 14; 3 float samples[10] = {-0.08,-0.05,-0.03,-0.02,-0.01,0.01,0.02,0.03,0.05,0.08}; 4 float2 dir = ScreenMult * float2(0.5,0.5) - UV; 5 float4 sum = SceneTextureLookup(UV, TexIndex, false); 6 float2 pos = float2(0.0,0.0); 7 for(int i = 0; i<10; i++) 8 { 9 pos = UV + dir * samples[i] * sampleDist; 10 max(min(pos, ScreenMult * float2(1.0, 1.0)), float2(0.0,0.0)); 11 sum += SceneTextureLookup(pos, TexIndex, false); 12 } 13 sum *= 1.0/11.0; 14 return sum;