MariENB 1.2015.9.29
This commit is contained in:
parent
a5a0e876a7
commit
9f7ab3c5f5
6 changed files with 190 additions and 144 deletions
|
|
@ -24,7 +24,7 @@ float depthlinear( float2 coord )
|
|||
/*
|
||||
These values seem to be used by pretty much all Skyrim ENB presets.
|
||||
Since it's practically impossible for me to know the real znear and
|
||||
zfar values for each game, I'll just use these and hope it all goes well
|
||||
zfar values for each game, I'll just use these and hope it goes well
|
||||
*/
|
||||
float zNear = 0.0509804;
|
||||
float zFar = 3098.0392;
|
||||
|
|
@ -209,9 +209,9 @@ float4 PS_SSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
|
|||
float3 sample;
|
||||
float sdepth, so, delta;
|
||||
float sclamp = ssaoclamp/1000.0;
|
||||
[unroll] for ( i=0; i<64; i++ )
|
||||
if ( ssaoquarter ) [unroll] for ( i=0; i<16; i++ )
|
||||
{
|
||||
sample = reflect(ssao_samples[i],rnormal);
|
||||
sample = reflect(ssao_samples_lq[i],rnormal);
|
||||
sample *= sign(dot(normal,sample));
|
||||
so = ldepth-sample.z*bof;
|
||||
sdepth = depthlinear(coord+bof*sample.xy/ldepth);
|
||||
|
|
@ -219,7 +219,17 @@ float4 PS_SSAOPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
|
|||
delta *= 1.0-smoothstep(0.0,sclamp,delta);
|
||||
if ( (delta > 0.0) && (delta < sclamp) ) occ += 1.0-delta;
|
||||
}
|
||||
float uocc = saturate(occ/64.0);
|
||||
else [unroll] for ( i=0; i<64; i++ )
|
||||
{
|
||||
sample = reflect(ssao_samples_hq[i],rnormal);
|
||||
sample *= sign(dot(normal,sample));
|
||||
so = ldepth-sample.z*bof;
|
||||
sdepth = depthlinear(coord+bof*sample.xy/ldepth);
|
||||
delta = saturate(so-sdepth);
|
||||
delta *= 1.0-smoothstep(0.0,sclamp,delta);
|
||||
if ( (delta > 0.0) && (delta < sclamp) ) occ += 1.0-delta;
|
||||
}
|
||||
float uocc = saturate(occ/(ssaoquarter?16.0:64.0));
|
||||
float fade = 1.0-depth;
|
||||
uocc *= saturate(pow(fade,ssaofadepow)*ssaofademult);
|
||||
uocc = saturate(pow(uocc,ssaopow)*ssaomult);
|
||||
|
|
@ -233,18 +243,18 @@ float4 PS_SSAOBlurH( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
|
|||
float4 res = tex2D(SamplerColor,coord);
|
||||
if ( !ssaoenable ) return res;
|
||||
if ( !ssaobenable ) return res;
|
||||
float bresl = (fixedx>0)?fixedx:ScreenSize.x;
|
||||
float bresl = ScreenSize.x;
|
||||
float bof = (1.0/bresl)*ssaobradius;
|
||||
float isd, sd, ds, sw, tw = 0;
|
||||
res.a = 0.0;
|
||||
int i;
|
||||
isd = tex2D(SamplerDepth,coord).x;
|
||||
[unroll] for ( i=-15; i<=15; i++ )
|
||||
[unroll] for ( i=-31; i<=31; i++ )
|
||||
{
|
||||
sd = tex2D(SamplerDepth,coord+float2(i,0)*bof).x;
|
||||
ds = abs(isd-sd)*ssaobfact+0.5;
|
||||
sw = 1.0/(ds+1.0);
|
||||
sw *= gauss16[abs(i)];
|
||||
sw *= gauss32[abs(i)];
|
||||
tw += sw;
|
||||
res.a += sw*tex2D(SamplerColor,coord+float2(i,0)*bof).a;
|
||||
}
|
||||
|
|
@ -261,18 +271,18 @@ float4 PS_SSAOBlurV( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
|
|||
if ( ssaodebug ) return saturate(res.a);
|
||||
return res*res.a;
|
||||
}
|
||||
float bresl = (fixedy>0)?fixedy:(ScreenSize.x*ScreenSize.w);
|
||||
float bresl = ScreenSize.x*ScreenSize.w;
|
||||
float bof = (1.0/bresl)*ssaobradius;
|
||||
float isd, sd, ds, sw, tw = 0;
|
||||
res.a = 0.0;
|
||||
int i;
|
||||
isd = tex2D(SamplerDepth,coord).x;
|
||||
[unroll] for ( i=-15; i<=15; i++ )
|
||||
[unroll] for ( i=-31; i<=31; i++ )
|
||||
{
|
||||
sd = tex2D(SamplerDepth,coord+float2(0,i)*bof).x;
|
||||
ds = abs(isd-sd)*ssaobfact+0.5;
|
||||
sw = 1.0/(ds+1.0);
|
||||
sw *= gauss16[abs(i)];
|
||||
sw *= gauss32[abs(i)];
|
||||
tw += sw;
|
||||
res.a += sw*tex2D(SamplerColor,coord+float2(0,i)*bof).a;
|
||||
}
|
||||
|
|
@ -363,14 +373,15 @@ float4 PS_DoFPrepass( VS_OUTPUT_POST IN, float2 vPos : VPOS ) : COLOR
|
|||
float dfc = abs(dep-foc);
|
||||
float dff = abs(dep);
|
||||
float dfu = dff;
|
||||
if ( doffixedcut && (dep >= cutoff*0.000001) ) dfu *= 0;
|
||||
/*
|
||||
Change power of dof based on field of view. Works only in Skyrim,
|
||||
Boris is just such a fucking assbutt that he doesn't update the
|
||||
FO3/FNV version to be feature-equal to this, inventing pathetic
|
||||
excuses. The FieldOfView variable seems to hold bogus values in Fallout
|
||||
completely unrelated to actual FOV (yes, I checked if it's in radians,
|
||||
and no, it isn't). The value appears to be 1.134452. I'll try to
|
||||
investigate its origins someday.
|
||||
excuses. The FieldOfView variable seems to hold bogus values in
|
||||
Fallout completely unrelated to actual FOV (yes, I checked if it's
|
||||
in radians, and no, it isn't). The value appears to be 1.134452.
|
||||
I'll try to investigate its origins someday.
|
||||
*/
|
||||
if ( dofrelfov )
|
||||
{
|
||||
|
|
@ -502,6 +513,13 @@ float2 UnderwaterDistort( float2 coord )
|
|||
float2 DistantHeat( float2 coord )
|
||||
{
|
||||
float2 bresl;
|
||||
float dep, odep;
|
||||
dep = tex2D(SamplerDepth,coord).x;
|
||||
float distfade = clamp(pow(dep,heatfadepow)*heatfademul+heatfadebump,
|
||||
0.0,1.0);
|
||||
if ( distfade <= 0.0 ) return coord;
|
||||
float todpow = pow(tod*(1.0-ind),heattodpow);
|
||||
if ( !heatalways && (todpow <= 0.0) ) return coord;
|
||||
if ( (fixedx > 0) && (fixedy > 0) ) bresl = float2(fixedx,fixedy);
|
||||
else bresl = float2(ScreenSize.x,ScreenSize.x*ScreenSize.w);
|
||||
float2 nc = coord*(bresl/256.0)*heatsize;
|
||||
|
|
@ -509,10 +527,11 @@ float2 DistantHeat( float2 coord )
|
|||
float2 ofs = tex2D(SamplerHeat,nc+ts).xy;
|
||||
ofs = (ofs-0.5)*2.0;
|
||||
ofs *= pow(length(ofs),heatpow);
|
||||
float distfade = tex2D(SamplerDepth,coord).x;
|
||||
distfade = clamp(pow(distfade,heatfadepow)*heatfademul+heatfadebump,
|
||||
if ( !heatalways ) ofs *= todpow;
|
||||
odep = tex2D(SamplerDepth,coord+ofs*heatstrength*distfade*0.01).x;
|
||||
float odistfade = clamp(pow(odep,heatfadepow)*heatfademul+heatfadebump,
|
||||
0.0,1.0);
|
||||
if ( !heatalways ) ofs *= pow(tod*(1.0-ind),heattodpow);
|
||||
if ( odistfade <= 0.0 ) return coord;
|
||||
return coord+ofs*heatstrength*distfade*0.01;
|
||||
}
|
||||
/* The pass that happens after everything else */
|
||||
|
|
|
|||
|
|
@ -26,50 +26,64 @@ static const float gauss8[8] =
|
|||
0.134598, 0.127325, 0.107778, 0.081638,
|
||||
0.055335, 0.033562, 0.018216, 0.008847
|
||||
};
|
||||
/* radius: 16, std dev: 6 */
|
||||
static const float gauss16[16] =
|
||||
/* radius: 32, std dev: 12 */
|
||||
static const float gauss32[32] =
|
||||
{
|
||||
0.067142, 0.066216, 0.063513, 0.059252,
|
||||
0.053763, 0.047446, 0.040723, 0.033996,
|
||||
0.027603, 0.021798, 0.016742, 0.012507,
|
||||
0.009087, 0.006421, 0.004413, 0.002950
|
||||
|
||||
0.033535, 0.033419, 0.033073, 0.032503,
|
||||
0.031723, 0.030747, 0.029595, 0.028288,
|
||||
0.026853, 0.025314, 0.023698, 0.022031,
|
||||
0.020340, 0.018649, 0.016980, 0.015353,
|
||||
0.013787, 0.012294, 0.010887, 0.009575,
|
||||
0.008362, 0.007252, 0.006247, 0.005343,
|
||||
0.004538, 0.003828, 0.003207, 0.002668,
|
||||
0.002204, 0.001808, 0.001473, 0.001192
|
||||
};
|
||||
/* SSAO samples */
|
||||
static const float3 ssao_samples[64] =
|
||||
static const float3 ssao_samples_lq[16] =
|
||||
{
|
||||
float3( 0.0000,-0.0002, 0.0002),float3(-0.0005, 0.0006, 0.0006),
|
||||
float3(-0.0003,-0.0018,-0.0012),float3( 0.0025, 0.0001,-0.0030),
|
||||
float3( 0.0032,-0.0031,-0.0042),float3(-0.0075, 0.0032, 0.0034),
|
||||
float3(-0.0017, 0.0107, 0.0050),float3(-0.0113,-0.0022,-0.0106),
|
||||
float3( 0.0113,-0.0000,-0.0162),float3(-0.0121,-0.0156,-0.0143),
|
||||
float3( 0.0145,-0.0099, 0.0238),float3(-0.0041, 0.0258,-0.0236),
|
||||
float3( 0.0261,-0.0282,-0.0150),float3(-0.0392, 0.0259, 0.0093),
|
||||
float3( 0.0079, 0.0122,-0.0530),float3(-0.0173, 0.0024,-0.0600),
|
||||
float3( 0.0164,-0.0483,-0.0487),float3( 0.0253, 0.0749, 0.0030),
|
||||
float3( 0.0702,-0.0024, 0.0532),float3(-0.0587, 0.0343,-0.0701),
|
||||
float3(-0.0284, 0.0949, 0.0422),float3(-0.0782,-0.0518, 0.0719),
|
||||
float3( 0.0891,-0.0295, 0.0887),float3(-0.1176,-0.0770, 0.0034),
|
||||
float3( 0.0911, 0.0979,-0.0736),float3(-0.0492,-0.1109,-0.1119),
|
||||
float3( 0.0881,-0.1122,-0.1064),float3(-0.0978,-0.0594,-0.1534),
|
||||
float3( 0.1226,-0.0478,-0.1577),float3( 0.1713, 0.1376,-0.0033),
|
||||
float3(-0.1098, 0.1317,-0.1601),float3( 0.0153, 0.0431,-0.2458),
|
||||
float3( 0.0413,-0.2602,-0.0358),float3( 0.1160, 0.2073,-0.1524),
|
||||
float3(-0.0891,-0.2844,-0.0254),float3(-0.2356, 0.1856, 0.1007),
|
||||
float3(-0.1331,-0.2241,-0.2093),float3(-0.0946,-0.0943, 0.3262),
|
||||
float3(-0.2076, 0.2990,-0.0735),float3(-0.3388,-0.1854,-0.0584),
|
||||
float3(-0.2950, 0.2562, 0.1256),float3( 0.1245, 0.3253, 0.2533),
|
||||
float3(-0.3334, 0.0732, 0.2954),float3(-0.0878,-0.0338, 0.4632),
|
||||
float3( 0.3257,-0.1494, 0.3406),float3( 0.1496, 0.4734, 0.1426),
|
||||
float3(-0.4816,-0.1498,-0.1911),float3(-0.4407,-0.2691,-0.2231),
|
||||
float3(-0.5739,-0.0862,-0.0829),float3(-0.1811,-0.4338, 0.3893),
|
||||
float3(-0.4059, 0.2597,-0.4135),float3( 0.5669,-0.1450, 0.3057),
|
||||
float3(-0.3459, 0.0907,-0.5852),float3(-0.0378,-0.4889,-0.5161),
|
||||
float3(-0.1609,-0.1172, 0.7112),float3(-0.1584, 0.2215,-0.7156),
|
||||
float3(-0.0601,-0.6410,-0.4634),float3(-0.1877,-0.4821, 0.6379),
|
||||
float3(-0.5357, 0.6528, 0.0957),float3(-0.5073,-0.3124, 0.6462),
|
||||
float3(-0.1505, 0.6792,-0.5842),float3( 0.1781,-0.9197, 0.0557),
|
||||
float3(-0.5309,-0.3378,-0.7369),float3(-0.7460, 0.2721,-0.6078)
|
||||
float3( 0.0000,-0.0002, 0.0000),float3(-0.0004, 0.0013, 0.0014),
|
||||
float3(-0.0030, 0.0048,-0.0034),float3( 0.0147, 0.0046,-0.0026),
|
||||
float3(-0.0097, 0.0275,-0.0092),float3(-0.0178,-0.0072, 0.0491),
|
||||
float3( 0.0227,-0.0431,-0.0681),float3( 0.1052, 0.0332,-0.0588),
|
||||
float3( 0.0997, 0.0056, 0.1473),float3(-0.1252, 0.2019, 0.0564),
|
||||
float3(-0.1054,-0.2072, 0.2271),float3(-0.0542, 0.3096, 0.2814),
|
||||
float3( 0.0072,-0.3534, 0.4035),float3(-0.0024,-0.2385, 0.6260),
|
||||
float3(-0.1940, 0.5722,-0.5602),float3(-0.0910,-0.7548,-0.6497)
|
||||
};
|
||||
static const float3 ssao_samples_hq[64] =
|
||||
{
|
||||
float3( 0.0000,-0.0000,-0.0000),float3( 0.0000, 0.0000,-0.0000),
|
||||
float3( 0.0001,-0.0000,-0.0000),float3( 0.0002, 0.0001,-0.0001),
|
||||
float3(-0.0000,-0.0005, 0.0000),float3( 0.0004,-0.0004,-0.0006),
|
||||
float3( 0.0005,-0.0011,-0.0004),float3(-0.0000, 0.0013,-0.0014),
|
||||
float3( 0.0024, 0.0006, 0.0013),float3(-0.0017,-0.0017, 0.0030),
|
||||
float3(-0.0037, 0.0033,-0.0011),float3( 0.0010, 0.0018,-0.0063),
|
||||
float3( 0.0059, 0.0056,-0.0020),float3(-0.0009, 0.0083,-0.0063),
|
||||
float3(-0.0110, 0.0065,-0.0016),float3( 0.0089, 0.0070,-0.0108),
|
||||
float3(-0.0115,-0.0134,-0.0062),float3(-0.0121,-0.0172, 0.0071),
|
||||
float3(-0.0066, 0.0246,-0.0060),float3( 0.0057,-0.0279, 0.0109),
|
||||
float3(-0.0269,-0.0160,-0.0164),float3( 0.0402, 0.0045, 0.0034),
|
||||
float3( 0.0248,-0.0045, 0.0390),float3( 0.0110,-0.0491,-0.0159),
|
||||
float3(-0.0193,-0.0431, 0.0363),float3( 0.0441, 0.0271,-0.0426),
|
||||
float3( 0.0385,-0.0428,-0.0482),float3(-0.0623,-0.0501, 0.0249),
|
||||
float3( 0.0683,-0.0000, 0.0631),float3( 0.1008, 0.0180,-0.0114),
|
||||
float3(-0.0156,-0.0713, 0.0871),float3(-0.0561,-0.0757, 0.0822),
|
||||
float3( 0.0714, 0.0850,-0.0805),float3(-0.1320,-0.0042, 0.0711),
|
||||
float3( 0.1553, 0.0486,-0.0167),float3(-0.1164,-0.0125,-0.1341),
|
||||
float3( 0.1380,-0.1230,-0.0562),float3( 0.0868,-0.1897,-0.0175),
|
||||
float3( 0.0749, 0.1495, 0.1525),float3(-0.2038,-0.1324,-0.0235),
|
||||
float3( 0.0205, 0.1920, 0.1784),float3( 0.1637,-0.0964,-0.2092),
|
||||
float3( 0.2875, 0.0966,-0.0020),float3( 0.0572,-0.0180,-0.3194),
|
||||
float3(-0.3329, 0.0981,-0.0189),float3( 0.2627, 0.2092,-0.1585),
|
||||
float3( 0.1783,-0.3359,-0.1108),float3( 0.2675, 0.2056,-0.2533),
|
||||
float3(-0.1852, 0.3017,-0.2759),float3(-0.0944, 0.3532, 0.3061),
|
||||
float3(-0.0022,-0.3744, 0.3404),float3(-0.0600,-0.4031,-0.3487),
|
||||
float3(-0.2663, 0.4915, 0.1004),float3(-0.2442, 0.4253, 0.3468),
|
||||
float3( 0.2583, 0.1321,-0.5645),float3(-0.0219, 0.4516, 0.4943),
|
||||
float3(-0.5503, 0.2597,-0.3590),float3( 0.2239,-0.5571,-0.4398),
|
||||
float3(-0.7210,-0.1982, 0.2339),float3( 0.7948,-0.1848, 0.1145),
|
||||
float3(-0.7190, 0.1767, 0.4489),float3(-0.5617, 0.5845,-0.4116),
|
||||
float3(-0.8919,-0.0384, 0.3360),float3(-0.0144, 0.9775,-0.2105)
|
||||
};
|
||||
/* standard stuff */
|
||||
float4 ScreenSize;
|
||||
|
|
|
|||
|
|
@ -521,6 +521,12 @@ float doffixedunfocusblend_id
|
|||
string UIWidget = "Spinner";
|
||||
float UIMin = 0.0;
|
||||
> = {0.0};
|
||||
/* prevents fixed dof from blurring the skybox */
|
||||
bool doffixedcut
|
||||
<
|
||||
string UIName = "DOF Fixed Use Cutoff";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {true};
|
||||
/* disable depth of field */
|
||||
bool dofdisable
|
||||
<
|
||||
|
|
@ -886,6 +892,11 @@ bool ssaodebug
|
|||
string UIName = "Debug SSAO";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
bool ssaoquarter
|
||||
<
|
||||
string UIName = "SSAO Use Less Samples";
|
||||
string UIWidget = "Checkbox";
|
||||
> = {false};
|
||||
/* luma sharpen because of reasons */
|
||||
string str_sharp = "Luma Sharpen";
|
||||
bool sharpenable
|
||||
|
|
|
|||
Reference in a new issue