1
Fork 0

MariENB FO4 3.0.5a

This commit is contained in:
Marisa the Magician 2019-04-07 17:47:39 +02:00
commit 0ac5ca02ac
7 changed files with 132 additions and 120 deletions

View file

@ -1,13 +1,23 @@
/* This shader intentionally left unchanged */
/*
enbadaptation.fx : MariENB3 eye adaptation shader.
(C)2016 Marisa Kirisame, UnSX Team.
Part of MariENB3, the personal ENB of Marisa for Fallout 4.
Released under the GNU GPLv3 (or later).
*/
#include "menbglobaldefs.fx"
float4 AdaptationParameters;
Texture2D TextureCurrent;
Texture2D TexturePrevious;
SamplerState Sampler0
{
Filter = MIN_MAG_MIP_POINT;
Filter = MIN_MAG_MIP_LINEAR;
AddressU = Clamp;
AddressV = Clamp;
};
struct VS_INPUT_POST
{
float3 pos : POSITION;
@ -18,86 +28,65 @@ struct VS_OUTPUT_POST
float4 pos : SV_POSITION;
float2 txcoord0 : TEXCOORD0;
};
VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN,
uniform float sizeX, uniform float sizeY)
VS_OUTPUT_POST VS_Quad( VS_INPUT_POST IN )
{
VS_OUTPUT_POST OUT;
float4 pos;
pos.xyz = IN.pos.xyz;
pos.w = 1.0;
OUT.pos = pos;
float2 offset;
offset.x = sizeX;
offset.y = sizeY;
OUT.txcoord0.xy = IN.txcoord.xy+offset.xy;
OUT.pos = float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
OUT.txcoord0.xy = IN.txcoord.xy;
return OUT;
}
float4 PS_Downsample(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
/* helper functions */
/* photometric */
#define luminance(x) dot(x,float3(0.2126,0.7152,0.0722))
/* CCIR601 */
//#define luminance(x) dot(x,float3(0.299,0.587,0.114))
float4 PS_Downsample( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
{
float4 res;
float2 pos, coord;
float4 curr = 0.0, currmax = 0.0;
const float scale = 1.0/16.0, step = 1.0/16.0, halfstep = 0.5/16.0;
pos.x = -0.5+halfstep;
for (int x=0; x<16; x++)
{
pos.y = -0.5+halfstep;
for (int y=0; y<16; y++)
{
coord = pos.xy*scale;
float4 tempcurr = TextureCurrent.Sample(Sampler0,
IN.txcoord0.xy+coord.xy);
currmax = max(currmax,tempcurr);
curr += tempcurr;
pos.y += step;
}
pos.x += step;
}
curr /= 256.0;
res = curr;
res = max(res.x,max(res.y,res.z));
float2 coord = IN.txcoord0.xy;
float ssz = 1.0/16.0;
float4 res = float4(0,0,0,0);
int x, y;
[unroll] for ( y=-8; y<8; y++ ) [unroll] for ( x=-8; x<8; x++ )
res += TextureCurrent.Sample(Sampler0,coord+float2(x,y)*ssz);
res /= 256.0;
res = luminance(res.rgb);
res.w = 1.0;
return res;
}
float4 PS_Adaptation(VS_OUTPUT_POST IN, float4 v0 : SV_Position0) : SV_Target
{
float4 res;
float prev = TexturePrevious.Sample(Sampler0,IN.txcoord0.xy).x;
float2 pos;
float curr = 0.0, currmax = 0.0;
const float step = 1.0/16.0, halfstep = 0.5/16.0;
pos.x = halfstep;
for (int x=0; x<16; x++)
float2 coord = IN.txcoord0.xy;
float prev = TexturePrevious.Sample(Sampler0,coord).x;
float ssz = 1.0/16.0;
float4 res = float4(0,0,0,0);
float smpmax = 0.0, smp;
int x, y;
[unroll] for ( y=-8; y<8; y++ ) [unroll] for ( x=-8; x<8; x++ )
{
pos.y = halfstep;
for (int y=0; y<16; y++)
{
float tempcurr = TextureCurrent.Sample(Sampler0,
IN.txcoord0.xy+pos.xy).x;
currmax = max(currmax,tempcurr);
curr += tempcurr;
pos.y += step;
}
pos.x += step;
smp = TextureCurrent.Sample(Sampler0,coord+float2(x,y)*ssz).x;
smpmax = max(smpmax,smp);
res += smp;
}
curr /= 256.0;
curr = lerp(curr,currmax,AdaptationParameters.z);
res = lerp(prev,curr,AdaptationParameters.w);
res = max(res,0.001);
res = min(res,16384.0);
float valmax, valcut;
valmax = max(res.x,max(res.y,res.z));
valcut = max(valmax,AdaptationParameters.x);
valcut = min(valcut,AdaptationParameters.y);
res *= valcut/(valmax+0.000000001);
res /= 256.0;
res = lerp(res,smpmax,AdaptationParameters.z);
res = lerp(prev,res,AdaptationParameters.w);
res = clamp(res,0.0,16384.0);
float vclip = clamp(res.x,AdaptationParameters.x,
AdaptationParameters.y);
res *= vclip/(res+0.000000001);
res.w = 1.0;
return res;
}
technique11 Downsample
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0,VS_Quad(0.0,0.0)));
SetVertexShader(CompileShader(vs_5_0,VS_Quad()));
SetPixelShader(CompileShader(ps_5_0,PS_Downsample()));
}
}
@ -105,7 +94,7 @@ technique11 Draw
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0,VS_Quad(0.0,0.0)));
SetVertexShader(CompileShader(vs_5_0,VS_Quad()));
SetPixelShader(CompileShader(ps_5_0,PS_Adaptation()));
}
}

View file

@ -624,7 +624,7 @@ float4 PS_PostPass( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
float4 PS_SPostPass( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
{
float2 coord = IN.txcoord0.xy;
float4 res = bloommixs*RenderTarget32.Sample(Sampler2,coord);
float4 res = bloommixs*RenderTarget128.Sample(Sampler2,coord);
res.rgb = clamp(res.rgb,0.0,32768.0);
res.a = 1.0;
if ( !dirtenable ) return res;
@ -704,6 +704,23 @@ technique11 BloomSimplePass6 <string RenderTarget="RenderTarget32";>
}
technique11 BloomSimplePass7
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0,VS_Quad()));
SetPixelShader(CompileShader(ps_5_0,PS_HorizontalBlur(RenderTarget128,128.0)));
}
}
technique11 BloomSimplePass8 <string RenderTarget="RenderTarget128";>
{
pass p0
{
SetVertexShader(CompileShader(vs_5_0,VS_Quad()));
SetPixelShader(CompileShader(ps_5_0,PS_VerticalBlur(TextureColor,128.0,3.0)));
}
}
technique11 BloomSimplePass9
{
pass p0
{
@ -711,7 +728,7 @@ technique11 BloomSimplePass7
SetPixelShader(CompileShader(ps_5_0,PS_HorizontalBlur(RenderTarget32,32.0)));
}
}
technique11 BloomSimplePass8 <string RenderTarget="RenderTarget32";>
technique11 BloomSimplePass10 <string RenderTarget="RenderTarget32";>
{
pass p0
{
@ -720,7 +737,7 @@ technique11 BloomSimplePass8 <string RenderTarget="RenderTarget32";>
}
}
technique11 BloomSimplePass9
technique11 BloomSimplePass11
{
pass p0
{

View file

@ -1,42 +1,42 @@
[ENBBLOOM.FX]
TECHNIQUE=1
Bloom Intensity Night=1.08
Bloom Intensity Day=1.13
Bloom Intensity Interior=1.11
Bloom Contrast Night=1.13
Bloom Contrast Day=1.19
Bloom Contrast Interior=1.15
Bloom Saturation Night=0.89
Bloom Intensity Night=0.51
Bloom Intensity Day=0.43
Bloom Intensity Interior=0.46
Bloom Contrast Night=0.92
Bloom Contrast Day=0.95
Bloom Contrast Interior=0.93
Bloom Saturation Night=0.87
Bloom Saturation Day=0.77
Bloom Saturation Interior=0.84
Bloom Offset Night=-0.23
Bloom Offset Night=-0.28
Bloom Offset Day=-0.44
Bloom Offset Interior=-0.38
Bloom Intensity Cap Night=2.0
Bloom Intensity Cap Day=2.0
Bloom Intensity Cap Interior=2.0
Bloom Intensity Cap Night=1.0
Bloom Intensity Cap Day=1.0
Bloom Intensity Cap Interior=1.0
Bloom Blur Radius=1.0
Blue Shift Night=0.294, 0.424, 0.859
Blue Shift Day=0.22, 0.537, 0.855
Blue Shift Interior=0.337, 0.525, 0.878
Blue Shift Intensity Night=0.94
Blue Shift Intensity Night=0.97
Blue Shift Intensity Day=0.72
Blue Shift Intensity Interior=0.88
Blue Shift Luminance Factor Per-pass=0.31
Blue Shift Color Factor Per-pass=0.79
Enable Anamorphic Bloom=true
Anamorphic Bloom Blend Night=0.94
Anamorphic Bloom Blend Day=0.4
Anamorphic Bloom Blend Interior=0.67
Anamorphic Bloom Blend Night=0.68
Anamorphic Bloom Blend Day=0.34
Anamorphic Bloom Blend Interior=0.44
Anamorphic Bloom Blue Shift Night=0.553, 0.404, 0.851
Anamorphic Bloom Blue Shift Day=0.424, 0.384, 0.831
Anamorphic Bloom Blue Shift Interior=0.537, 0.475, 0.89
Anamorphic Bloom Blue Shift Intensity Night=2.31
Anamorphic Bloom Blue Shift Intensity Day=1.59
Anamorphic Bloom Blue Shift Intensity Interior=1.86
Anamorphic Bloom Contrast Night=0.92
Anamorphic Bloom Contrast Night=0.95
Anamorphic Bloom Contrast Day=1.0
Anamorphic Bloom Contrast Interior=0.96
Anamorphic Bloom Contrast Interior=0.97
Anamorphic Bloom Radius Multiplier=1.0
Bloom Intensity Interior Night=1.33
Bloom Intensity Interior Day=1.26
@ -80,12 +80,12 @@ Anamorphic Bloom Blue Shift Interior Night=1.86
Anamorphic Bloom Blue Shift Interior Day=1.86
Anamorphic Bloom Contrast Interior Night=1.12
Anamorphic Bloom Contrast Interior Day=1.22
Bloom Pass 1 Blend=0.84
Bloom Pass 2 Blend=0.68
Bloom Pass 3 Blend=0.59
Bloom Pass 4 Blend=0.76
Bloom Pass 5 Blend=1.07
Bloom Pass 6 Blend=1.68
Bloom Pass 1 Blend=0.13
Bloom Pass 2 Blend=0.24
Bloom Pass 3 Blend=0.36
Bloom Pass 4 Blend=0.52
Bloom Pass 5 Blend=0.69
Bloom Pass 6 Blend=1.0
Enable Lens Dirt=true
Dirt Pass 1 Blend=0.03
Dirt Pass 2 Blend=0.12
@ -95,7 +95,7 @@ Dirt Pass 5 Blend=0.67
Dirt Pass 6 Blend=3.66
Dirt Contrast=0.92
Dirt Factor=2.07
Bloom Blur Radius X=1.92
Bloom Blur Radius Y=1.08
Bloom Single Pass Blend=0.37
Dirt Single Pass Blend=0.71
Bloom Blur Radius X=1.0
Bloom Blur Radius Y=1.0
Bloom Single Pass Blend=0.29
Dirt Single Pass Blend=1.13

View file

@ -107,7 +107,7 @@ SSAO Fade Intensity Night=10.5
SSAO Fade Intensity Day=12.5
SSAO Fade Intensity Interior=11.5
SSAO Intensity=1.2
SSAO Contrast=0.75
SSAO Contrast=0.65
SSAO Blending=0.8
SSAO Blur=true
SSAO Bilateral Factor=1500.0

View file

@ -398,7 +398,11 @@ bool bloomdebug
string UIName = "Display Bloom";
string UIWidget = "Checkbox";
> = {false};
bool adaptdebug
<
string UIName = "Display Adaptation";
string UIWidget = "Checkbox";
> = {false};
/*
dithering threshold maps
@ -753,7 +757,7 @@ float4 PS_Draw( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
/* Insert MariENB filters here */
float2 coord = IN.txcoord0.xy;
if ( bloomdebug ) res = TextureBloom.Sample(Sampler1,Params01[4].zw
*IN.txcoord0.xy)*ENBParams01.x;
*coord)*ENBParams01.x;
if ( tmapenable ) res.rgb = Tonemap(res.rgb);
if ( gradeenable1 ) res.rgb = GradingRGB(res.rgb);
if ( colorizeafterhsv )
@ -768,6 +772,7 @@ float4 PS_Draw( VS_OUTPUT_POST IN, float4 v0 : SV_Position0 ) : SV_Target
}
if ( lutenable ) res.rgb = GradingLUT(res.rgb);
if ( ne ) res.rgb = FilmGrain(res.rgb,coord);
if ( adaptdebug ) res.rgb = TextureAdaptation.Sample(Sampler1,coord).x;
if ( dodither ) res.rgb = Dither(res.rgb,coord);
res.rgb = max(0,res.rgb);
res.a = 1.0;

View file

@ -140,3 +140,4 @@ Grading Value Contrast Interior Night=1.42
Grading Value Contrast Interior Day=1.62
LUT Blend Interior Night=0.39
LUT Blend Interior Day=0.45
Display Adaptation=false