1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#define DOF_1
float4 SSFragment ( in float2 eSamplerTexcoord : TEXCOORD0,
uniform sampler SceneTexture : register (s0)
) : COLOR
{
#ifdef DOF_1
const float2 Samples[10] = {
{-0.48164210f, 0.63774880f},
{-0.75966840f,-0.50366960f},
{ 0.34809640f,-0.14834620f},
{ 0.96111000f,-0.16738010f},
{ 0.21908510f,-0.96834350f},
{ 0.15818150f, 0.70767760f},
{-0.81477860f,-0.19214370f},
{ 0.51399410f,-0.68631670f},
{ 0.48325500f, 0.23895880f},
{ 0.67731140f,-0.33620170f}
};
float Transp = tex2D (SceneTexture, eSamplerTexcoord).a ;
// Transp = saturate (abs (Transp));
Transp /= 200;
float3 EndColor = {0.0f, 0.0f, 0.0f};
for (int i = 0; i<10; i++)
{
float2 Corod = eSamplerTexcoord + (Samples[i] * Transp) ;
EndColor += tex2D (SceneTexture, Corod).xyz;
}
return float4 (EndColor[0] / 10, EndColor[1] / 10, EndColor[2] / 10, 1.0f);
#else
return float4 (tex2D (SceneTexture, eSamplerTexcoord).xyz, 1.0f);
#endif
}
|