MariENB 2.0.3
This commit is contained in:
parent
ab0714c476
commit
0a41987699
5 changed files with 24 additions and 99 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 7.9 KiB |
|
|
@ -422,38 +422,23 @@ float4 PS_DoFBlurH( VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
|
|||
float sd, ds, sw, tw = 0;
|
||||
float2 bsz = bof*dofpradius*dfc;
|
||||
float4 sc;
|
||||
[unroll] for ( int i=0; i<16; i++ )
|
||||
[unroll] for ( int i=0; i<32; i++ )
|
||||
{
|
||||
sc = tex2Dlod(SamplerColor,float4(coord.x
|
||||
+poisson16[i].x*bsz.x,coord.y+poisson16[i].y
|
||||
+poisson32[i].x*bsz.x,coord.y+poisson32[i].y
|
||||
*bsz.y,0.0,dfc));
|
||||
ds = tex2D(SamplerDepth,coord+poisson16[i]*bsz).x;
|
||||
sd = tex2D(SamplerColor,coord+poisson16[i]*bsz).a;
|
||||
ds = tex2D(SamplerDepth,coord+poisson32[i]*bsz).x;
|
||||
sd = tex2D(SamplerColor,coord+poisson32[i]*bsz).a;
|
||||
sw = (ds>dep)?1.0:sd;
|
||||
tw += sw;
|
||||
res += sc*sw;
|
||||
}
|
||||
res /= tw;
|
||||
}
|
||||
/* check if bokeh point */
|
||||
const float2 pts[9] =
|
||||
{
|
||||
float2(-1.5,-1.5),float2( 0.5,-1.5),float2( 1.5,-1.5),
|
||||
float2(-1.5, 0.5),float2( 0.5, 0.5),float2( 1.5, 1.5),
|
||||
float2(-1.5, 1.5),float2( 0.5, 1.5),float2( 1.5, 1.5)
|
||||
};
|
||||
float4 col = float4(0,0,0,0);
|
||||
[unroll] for ( int i=0; i<9; i++ )
|
||||
col += tex2D(SamplerColor,coord+pts[i]*bof);
|
||||
col /= 9.0;
|
||||
float lum = luminance(col), clum = luminance(ccol);
|
||||
if ( (max(clum-lum,0.0) > bokthr) && (dfc > bokbthr) )
|
||||
col.a = min(clum*dfc,1.0);
|
||||
else col.a = 0.0;
|
||||
res.a = col.a;
|
||||
res.a = dfc;
|
||||
return res;
|
||||
}
|
||||
/* bokeh pass */
|
||||
/* nobody here, only one pass is really needed */
|
||||
float4 PS_DoFBlurV( VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
|
||||
{
|
||||
float2 coord = IN.txcoord.xy;
|
||||
|
|
@ -461,34 +446,7 @@ float4 PS_DoFBlurV( VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
|
|||
float dfc = tex2D(SamplerColor,coord).a;
|
||||
if ( dofdebug ) return tex2D(SamplerDepth,coord).x;
|
||||
if ( dfcdebug ) return dfc;
|
||||
float2 bresl;
|
||||
if ( (fixedx > 0) && (fixedy > 0) ) bresl = float2(fixedx,fixedy);
|
||||
else bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float2 bof = (1.0/bresl);
|
||||
float4 res = tex2D(SamplerColor,coord);
|
||||
// It's bokeh time
|
||||
float2 rcoord;
|
||||
int rsmp;
|
||||
float rstep, bsmp, bft, tw = 0;
|
||||
float4 bcol = float4(0,0,0,0);
|
||||
[unroll] for ( int r=1; r<=5; r++ )
|
||||
{
|
||||
rsmp = r*3;
|
||||
[loop] for ( int s=0; s<rsmp; s++ )
|
||||
{
|
||||
rstep = pi*2.0/float(rsmp);
|
||||
rcoord.x = (cos(float(s)*rstep)*float(r));
|
||||
rcoord.y = (sin(float(s)*rstep)*float(r));
|
||||
bsmp = tex2D(SamplerBokeh,0.5+rcoord/10.0).x;
|
||||
bft = tex2D(SamplerColor,coord+(rcoord/5.0)*bof
|
||||
*boksiz).a;
|
||||
bcol += tex2D(SamplerColor,coord+(rcoord/5.0)*bof
|
||||
*boksiz)*bft*bsmp;
|
||||
tw += bsmp;
|
||||
}
|
||||
}
|
||||
bcol /= tw;
|
||||
res = res+bcol;
|
||||
res.a = 1.0;
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ static const float3x3 GY =
|
|||
0, 0, 0,
|
||||
-1,-2,-1
|
||||
};
|
||||
/* gaussian kernels */
|
||||
/* radius: 8, std dev: 6 */
|
||||
static const float gauss8[8] =
|
||||
{
|
||||
|
|
@ -83,16 +82,24 @@ static const float3 ssao_samples_hq[64] =
|
|||
};
|
||||
/* For high quality DOF */
|
||||
#ifdef USE_BOKEH
|
||||
static const float2 poisson16[16] =
|
||||
static const float2 poisson32[32] =
|
||||
{
|
||||
float2( 0.20698410, 0.22452690),float2( 0.52580800,-0.23108170),
|
||||
float2( 0.13839430, 0.90561220),float2( 0.66330090, 0.51298430),
|
||||
float2(-0.40027920, 0.37270580),float2( 0.07912822,-0.65129210),
|
||||
float2(-0.77260670,-0.51512170),float2(-0.38431930,-0.14941320),
|
||||
float2(-0.91077820, 0.25006330),float2( 0.69401530,-0.70989270),
|
||||
float2(-0.19646690,-0.37938900),float2(-0.47692860, 0.18408630),
|
||||
float2(-0.24732800,-0.87984590),float2( 0.42065410,-0.71477200),
|
||||
float2( 0.58293480,-0.09794202),float2( 0.36918380, 0.41406420)
|
||||
float2( 0.7284430,-0.1927130),float2( 0.4051600,-0.2312710),
|
||||
float2( 0.9535280, 0.0669683),float2( 0.6544140,-0.4439470),
|
||||
float2( 0.6029910, 0.1058970),float2( 0.2637500,-0.7163810),
|
||||
float2( 0.9105380,-0.3889810),float2( 0.5942730,-0.7400740),
|
||||
float2( 0.8215680, 0.3162520),float2( 0.3577550, 0.4884250),
|
||||
float2( 0.6935990, 0.7070140),float2( 0.0470570, 0.1961800),
|
||||
float2(-0.0977021, 0.6241300),float2( 0.2110300, 0.8778350),
|
||||
float2(-0.3743440, 0.2494580),float2( 0.0144776,-0.0766484),
|
||||
float2(-0.3377660,-0.1255100),float2( 0.3136420, 0.1077710),
|
||||
float2(-0.5204340, 0.8369860),float2(-0.1182680, 0.9801750),
|
||||
float2(-0.6969480,-0.3869330),float2(-0.6156080, 0.0307209),
|
||||
float2(-0.3806790,-0.6055360),float2(-0.1909570,-0.3861330),
|
||||
float2(-0.2449080,-0.8655030),float2( 0.0822108,-0.4975580),
|
||||
float2(-0.5649250, 0.5756740),float2(-0.8741830,-0.1685750),
|
||||
float2( 0.0761715,-0.9631760),float2(-0.9218270, 0.2121210),
|
||||
float2(-0.6378530, 0.3053550),float2(-0.8425180, 0.4753000)
|
||||
};
|
||||
#endif
|
||||
/* standard stuff */
|
||||
|
|
@ -136,12 +143,6 @@ texture2D texFrostBump
|
|||
string ResourceName = "menbfrostbump.png";
|
||||
#endif
|
||||
>;
|
||||
#ifdef USE_BOKEH
|
||||
texture2D texBokeh
|
||||
<
|
||||
string ResourceName = "menbbokeh.png";
|
||||
>;
|
||||
#endif
|
||||
texture2D texFocus;
|
||||
texture2D texCurr;
|
||||
texture2D texPrev;
|
||||
|
|
@ -217,20 +218,6 @@ sampler2D SamplerFrostBump = sampler_state
|
|||
MaxMipLevel = 0;
|
||||
MipMapLodBias = 0;
|
||||
};
|
||||
#ifdef USE_BOKEH
|
||||
sampler2D SamplerBokeh = sampler_state
|
||||
{
|
||||
Texture = <texBokeh>;
|
||||
MinFilter = LINEAR;
|
||||
MagFilter = LINEAR;
|
||||
MipFilter = NONE;
|
||||
AddressU = Border;
|
||||
AddressV = Border;
|
||||
SRGBTexture = FALSE;
|
||||
MaxMipLevel = 0;
|
||||
MipMapLodBias = 0;
|
||||
};
|
||||
#endif
|
||||
sampler2D SamplerFocus = sampler_state
|
||||
{
|
||||
Texture = <texFocus>;
|
||||
|
|
|
|||
|
|
@ -673,26 +673,6 @@ float relfovfactor_id
|
|||
string UIWidget = "Spinner";
|
||||
> = {2.0};
|
||||
#endif
|
||||
#ifdef USE_BOKEH
|
||||
float bokthr
|
||||
<
|
||||
string UIName = "Bokeh Threshold";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {1.0};
|
||||
float bokbthr
|
||||
<
|
||||
string UIName = "Bokeh Blur Threshold";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {0.5};
|
||||
float boksiz
|
||||
<
|
||||
string UIName = "Bokeh Size";
|
||||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {8.0};
|
||||
#endif
|
||||
bool dofdebug
|
||||
<
|
||||
string UIName = "Debug Depth";
|
||||
|
|
|
|||
|
|
@ -180,4 +180,4 @@ SSAO Blur Use Less Samples=true
|
|||
Bokeh Threshold=1.0
|
||||
Bokeh Blur Threshold=0.5
|
||||
Bokeh Size=8.0
|
||||
DOF Gather Blur Radius=6.0
|
||||
DOF Gather Blur Radius=8.0
|
||||
|
|
|
|||
Reference in a new issue