Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static const int iBlurSamples = 21;
- inline float GetGaussAccum() {
- int n = iBlurSamples;
- for (int i = 0; i < iBlurSamples; ++i) {
- n += i + i;
- }
- return 1.0 / float(n);
- }
- float3 Gauss(sampler sp, float2 uv, float2 dir) {
- float3 col = tex2D(sp, uv).rgb * float(iBlurSamples);
- static const float accum = GetGaussAccum();
- for (int i = 1; i < iBlurSamples; ++i) {
- float weight = float(iBlurSamples - i);
- col += tex2D(sp, uv + PixelSize * dir * float(i)).rgb * weight;
- col += tex2D(sp, uv - PixelSize * dir * float(i)).rgb * weight;
- }
- return col * accum;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement