Beruflich Dokumente
Kultur Dokumente
1 2 3 2 1 2 5 7 8
2 3 0 1 2 5 8 11 14
3 1 3 1 0 6 12 16 19
4 1 4 2 2 7 17 23 28
Original Summed-area table
+ -
UL UR LR − UR − LL + UL
average =
- + h
w*h
LL w LR
return result;
}
Pi ( x, y ) = Pi −1 ( x, y ) + Pi −1 ( x − 2 passindex
, y)
0 0 0 0 1 2 3 4 5 6 7 8
0
1
0 0 0 0 1 1..2 1..3 1..4 2..5 3..6 4..7 5..8
2
0 0 0 0 1 1..2 1..3 1..4 1..5 1..6 1..7 1..8
Pass
index
Sampling off the texture returns 0 so
that the sum doesn’t get affected.
float fPassIndex;
float2 vPixelSize;
float4x4 mVP;
struct VsOutput
{
float4 pos : POSITION0;
float4 uv[8] : TEXCOORD0; // 16 UVs stuffed in 8 float4’s
};
[…]
[…]
float passOffset = pow(16.0, fPassIndex) * vPixelSize.x;
return o;
}
return t[0]+t[4];
}
> To make sure sampling off the texture does not mess
up the results we need to set up the correct texture
clamping behavior
> Two possibilities:
> Clamp to border color with a color of (0, 0, 0, 0)
> Render a black border around the texture to be converted
into SAT and set Clamp to Edge mode
Color
channels
Alpha
channel
// normalize result
return cRefl.rgb / cRefl.a;
}
GDC 2005: Dynamic Glossy Environment Reflections 22
Demo