a me sembra molto piu bella la visuale con quella sfuocatura invece che la solita immagine piatta.....ma come hai detto sono gusti.......Se vuoi togliere la sfuocatura e l'autofocus e avere tutta l'immagine nitida c'è gia un modo!
Ecco qua, basta metterlo nell enbeffect.fx e addio sfuocatura, l'immagine è tutta nitida ora
#define StaticDOF
#ifdef StaticDOF
float2 center;
float depth;
float focus;
depth=r0.z * r0.x - _c78.w; //dofDist.w
depth+=_c78.y * -r3.w; //dofDist.y
depth+=148;//offset
center.x=_v0.x-0.5;
center.y=0.5-_v0.y;
int DoF_TAPS = 12;
if(DoF_TAPS > 0){
depth = max(depth, 0);
float4 vDofParams = float4(-50, 1.5, 1000.0, 0.5);
float dist;
if(depth < vDofParams.y)
dist = (depth - vDofParams.y)/(vDofParams.y - vDofParams.x);
else
{
dist = (depth - vDofParams.y)/(vDofParams.z - vDofParams.y);
dist = clamp(dist, 0, vDofParams.w);
}
dist = dist * 0.5 + 0.5;
static float3 poisson[24]=
{
float3(1.0, 0.0, 1.0000 ), //0 degrees
float3(0.0, -1.0, 1.0000 ),
float3(-1.0, 0.0, 1.0000 ),
float3(0.0, 1.0, 1.0000 ),
float3(0.7071, 0.7071, 1.0000 ), //45 degrees
float3(0.7071, 0.7071, 1.0000 ),
float3(-0.7071, -0.7071, 1.0000 ),
float3(-0.7071, 0.7071, 1.0000 ),
float3(0.9659, 0.2588, 1.0000 ), //15 degrees
float3(0.2588, -0.9659, 1.0000 ),
float3(-0.9659, -0.2588, 1.0000 ),
float3(-0.2588, 0.9659, 1.0000 ),
float3(0.8660, 0.5000, 1.0000 ), //60 degrees
float3(0.5000, -0.8660, 1.0000 ),
float3(-0.8660, -0.5000, 1.0000 ),
float3(-0.5000, 0.8660, 1.0000 ),
float3(0.5000, 0.8660, 1.0000 ), //30 degrees
float3(0.8660, -0.5000, 1.0000 ),
float3(-0.5000, -0.8660, 1.0000 ),
float3(-0.8660, 0.5000, 1.0000 ),
float3(0.2588, 0.9659, 1.0000 ), //75 degrees
float3(0.9659, -0.2588, 1.0000 ),
float3(-0.2588, -0.9659, 1.0000 ),
float3(-0.9659, 0.2588, 1.0000 ),
};
float2 pixelSizeHigh;
float2 pixelSizeLow;
pixelSizeHigh.x = 1.00 / _c44.x;
pixelSizeHigh.y = 1.00 / _c44.y;
pixelSizeHigh.xy *= 1;
pixelSizeLow.xy = pixelSizeHigh.xy;
float2 vMaxCoC = float2(6.0, 12.0); //5, 10
float radiusScale = 0.2;
float discRadius;
float discRadiusLow;
float centerDepth;
float4 tdepth;
float4 tapHigh;
float4 tapLow;
centerDepth = dist;
discRadius = abs(centerDepth * vMaxCoC.y - vMaxCoC.x);
discRadiusLow = discRadius * radiusScale;
r1 = 0.0;
for(int t = 0; t < DoF_TAPS; t++)
{
float2 coordLow = _v0.xy + (pixelSizeLow.xy * poisson[t].xy * discRadiusLow);
float2 coordHigh = _v0.xy + (pixelSizeHigh.xy * poisson[t].xy * discRadius);
tapLow = tex2D(s2, coordLow.xy) * poisson[t].z;
tapHigh = tex2D(s2, coordHigh.xy) * poisson[t].z;
tdepth = tex2D(s1, coordHigh.xy); //GBufferTextureSampler3
tdepth.y = -_c77.x + _c77.y; //-dofProj.x + dofProj.y
tdepth.y = 1.0 / tdepth.y;
tdepth.z = tdepth.y * _c77.y; //dofProj.y
tdepth.z = tdepth.z * -_c77.x; //dofProj.x
tdepth.x = _c77.y * -tdepth.y + tdepth.x;
tdepth.x = 1.0 / tdepth.x;
tdepth.w = tdepth.z * tdepth.x - _c78.w; //dofDist.w
tdepth.w += _c78.y * -r3.w; //dofDist.y
tdepth.w += 148;//offset
tdepth.w = max(tdepth.w, 0); //fix zoom bug
if(tdepth.w < vDofParams.y)
tapHigh.w = (tdepth.w - vDofParams.y)/(vDofParams.y - vDofParams.x);
else
{
tapHigh.w = (tdepth.w - vDofParams.y)/(vDofParams.z - vDofParams.y);
tapHigh.w = clamp(tapHigh.w, 0, vDofParams.w);
}
tapHigh.w = tapHigh.w * 0.5 + 0.5;
tapLow.w = tapHigh.w;
float tapBlur = abs(tapHigh.w * 2.0 - 1.0);
float4 tap = lerp(tapHigh, tapLow, tapBlur);
if(tap.w >= centerDepth) tap.w = 1.0;
else tap.w = abs(tap.w * 2.0 - 1.0);
r1.xyz += tap.xyz * tap.w;
r1.w += tap.w;
}
r1.xyz /= r1.w;