Ported MariENB tonemappers.
This commit is contained in:
parent
e8b7b1c29f
commit
f7c175d1bb
9 changed files with 187 additions and 4 deletions
|
|
@ -16,6 +16,10 @@ Makes the screen fuzzy. A couple parameters can be tweaked freely.
|
|||
|
||||
Overlays a noisy pattern onto the screen to make it filthy. Not a very good filter, tbh, but I just kept it in for historical reasons.
|
||||
|
||||
### Tonemap
|
||||
|
||||
GZDoom's own tone mapping can cause visual glitches in some mods, such as Lithium. My implementations copied almost as-is from MariENB don't have that issue. And on top of that, ever parameter of the Uncharted 2 tone mapper is customizable (fun times).
|
||||
|
||||
### Color Grading Suite
|
||||
|
||||
Control over RGB gamma/intensity, along with a "tint" filter that, with a negative intensity, can also be used as a color booster (dunno how this even works, I wrote it 7 years ago lol). On top of all that, you can also do the same for saturation and value (not hue because that would just be dumb).
|
||||
|
|
@ -62,10 +66,6 @@ It's very unlikely that this one will be added, unless I can hack something horr
|
|||
|
||||
Not a chance, this thing very blatantly needs Depth Buffer access, which is impossible in GZDoom thanks to portal rendering.
|
||||
|
||||
### Tonemap
|
||||
|
||||
Not needed, GZDoom implements its own.
|
||||
|
||||
### Screen Frost / Heat Haze
|
||||
|
||||
These aren't "general purpose" enough to be included.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,17 @@ nosave bool mfx_dirtenable = false;
|
|||
nosave float mfx_dirtcfactor = .05;
|
||||
nosave float mfx_dirtmc = 4.;
|
||||
|
||||
nosave int mfx_tenable = 0;
|
||||
nosave float mfx_texposure = 1.;
|
||||
nosave float mfx_tblend = 1.;
|
||||
nosave float mfx_una = .5;
|
||||
nosave float mfx_unb = 1.;
|
||||
nosave float mfx_unc = .2;
|
||||
nosave float mfx_und = .75;
|
||||
nosave float mfx_une = .02;
|
||||
nosave float mfx_unf = .3;
|
||||
nosave float mfx_unw = 10.;
|
||||
|
||||
nosave bool mfx_gradeenable = false;
|
||||
nosave float mfx_grademul_r = 1.;
|
||||
nosave float mfx_grademul_g = 1.;
|
||||
|
|
|
|||
29
gldefs.txt
29
gldefs.txt
|
|
@ -45,6 +45,35 @@ HardwareShader postprocess scene
|
|||
Texture NoiseTexture "textures/mfxdirt.png"
|
||||
}
|
||||
|
||||
HardwareShader postprocess scene
|
||||
{
|
||||
Name "mfx_tonemap_reinhard"
|
||||
Shader "shaders/glsl/mfx_tonemap_reinhard.fp" 330
|
||||
Uniform float texposure
|
||||
Uniform float tblend
|
||||
}
|
||||
HardwareShader postprocess scene
|
||||
{
|
||||
Name "mfx_tonemap_uc2"
|
||||
Shader "shaders/glsl/mfx_tonemap_uc2.fp" 330
|
||||
Uniform float texposure
|
||||
Uniform float tblend
|
||||
Uniform float unA
|
||||
Uniform float unB
|
||||
Uniform float unC
|
||||
Uniform float unD
|
||||
Uniform float unE
|
||||
Uniform float unF
|
||||
Uniform float unW
|
||||
}
|
||||
HardwareShader postprocess scene
|
||||
{
|
||||
Name "mfx_tonemap_hejldawson"
|
||||
Shader "shaders/glsl/mfx_tonemap_hejldawson.fp" 330
|
||||
Uniform float texposure
|
||||
Uniform float tblend
|
||||
}
|
||||
|
||||
HardwareShader postprocess scene
|
||||
{
|
||||
Name "mfx_grading"
|
||||
|
|
|
|||
13
language.txt
13
language.txt
|
|
@ -141,6 +141,19 @@ MFX_BNP="Grain Dark Mask Contrast";
|
|||
MFX_DIRT="Screen Dirt";
|
||||
MFX_DIRTMC="Dirt Scale";
|
||||
MFX_DIRTCFACTOR="Dirt Intensity";
|
||||
MFX_TMAP="Tone Mapping";
|
||||
MFX_TMAP1="Reinhard";
|
||||
MFX_TMAP2="Uncharted 2";
|
||||
MFX_TMAP3="Hejl Dawson";
|
||||
MFX_TEXPOSURE="Exposure";
|
||||
MFX_TBLEND="Blend Factor";
|
||||
MFX_UNA="(Uncharted 2) Shoulder Strength";
|
||||
MFX_UNB="(Uncharted 2) Linear Strength";
|
||||
MFX_UNC="(Uncharted 2) Linear Angle";
|
||||
MFX_UND="(Uncharted 2) Toe Strength";
|
||||
MFX_UNE="(Uncharted 2) Toe Numerator";
|
||||
MFX_UNF="(Uncharted 2) Toe Denominator";
|
||||
MFX_UNW="(Uncharted 2) Linear White";
|
||||
MFX_GRADE="Color Grading";
|
||||
MFX_GRADEMUL_R="Red Intensity";
|
||||
MFX_GRADEMUL_G="Green Intensity";
|
||||
|
|
|
|||
22
menudef.txt
22
menudef.txt
|
|
@ -15,6 +15,14 @@ OptionValue "MFXGrainBlend"
|
|||
3, "$MFX_BLENDMODE4"
|
||||
}
|
||||
|
||||
OptionValue "MFXTonemap"
|
||||
{
|
||||
0, "$TXT_NO"
|
||||
1, "$MFX_TMAP1"
|
||||
2, "$MFX_TMAP2"
|
||||
3, "$MFX_TMAP3"
|
||||
}
|
||||
|
||||
OptionValue "MFXVigShape"
|
||||
{
|
||||
0, "$MFX_VIGSHAPE1"
|
||||
|
|
@ -196,6 +204,20 @@ OptionMenu "MFXOptionsMenu"
|
|||
MFXSlider "$MFX_DIRTCFACTOR", "mfx_dirtcfactor", 0, 1, 0.01, 2
|
||||
SafeCommand "$MFX_RESET", "event resetmfxvars 1"
|
||||
StaticText " "
|
||||
StaticText "$MFX_TMAP", 1
|
||||
StaticText " "
|
||||
Option "$MFX_ENABLE", "mfx_tenable", "MFXTonemap"
|
||||
MFXSlider "$MFX_TEXPOSURE", "mfx_texposure", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_TBLEND", "mfx_tblend", 0, 1, 0.01, 2
|
||||
MFXSlider "$MFX_UNA", "mfx_una", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_UNB", "mfx_unb", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_UNC", "mfx_unc", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_UND", "mfx_und", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_UNE", "mfx_une", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_UNF", "mfx_unf", 0, 10, 0.01, 2
|
||||
MFXSlider "$MFX_UNW", "mfx_unw", 0, 10, 0.01, 2
|
||||
SafeCommand "$MFX_RESET", "event resetmfxvars 12"
|
||||
StaticText " "
|
||||
StaticText "$MFX_GRADE", 1
|
||||
StaticText " "
|
||||
Option "$MFX_ENABLE", "mfx_gradeenable", "YesNo"
|
||||
|
|
|
|||
18
shaders/glsl/mfx_tonemap_hejldawson.fp
Normal file
18
shaders/glsl/mfx_tonemap_hejldawson.fp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
Hejl Dawson tonemap from MariENB
|
||||
People claim this one looks realistic???
|
||||
(C)2012-2023 Marisa the Magician
|
||||
*/
|
||||
vec3 TonemapHejlDawson( vec3 res )
|
||||
{
|
||||
vec3 x = max(vec3(0.),res-.004);
|
||||
return (x*(6.2*x+.5))/(x*(6.2*x+1.7)+.06);
|
||||
}
|
||||
void main()
|
||||
{
|
||||
vec2 coord = TexCoord;
|
||||
vec4 res = texture(InputTexture,coord);
|
||||
vec3 mapped = TonemapHejlDawson(pow(max(res.rgb*texposure,0.),vec3(2.2)));
|
||||
res.rgb = mix(res.rgb,mapped,tblend);
|
||||
FragColor = res;
|
||||
}
|
||||
17
shaders/glsl/mfx_tonemap_reinhard.fp
Normal file
17
shaders/glsl/mfx_tonemap_reinhard.fp
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
"Ugly old" Reinhard tonemap from MariENB
|
||||
(C)2012-2023 Marisa the Magician
|
||||
*/
|
||||
vec3 TonemapReinhard( vec3 res )
|
||||
{
|
||||
vec3 tcol = res/(1.+res);
|
||||
return pow(tcol,vec3(1./2.2));
|
||||
}
|
||||
void main()
|
||||
{
|
||||
vec2 coord = TexCoord;
|
||||
vec4 res = texture(InputTexture,coord);
|
||||
vec3 mapped = TonemapReinhard(pow(max(res.rgb*texposure,vec3(0.)),vec3(2.2)));
|
||||
res.rgb = mix(res.rgb,mapped,tblend);
|
||||
FragColor = res;
|
||||
}
|
||||
24
shaders/glsl/mfx_tonemap_uc2.fp
Normal file
24
shaders/glsl/mfx_tonemap_uc2.fp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
"Uncharted 2" tonemap from MariENB
|
||||
(C)2012-2023 Marisa the Magician
|
||||
*/
|
||||
vec3 Uch( vec3 res )
|
||||
{
|
||||
// I have no idea how this works
|
||||
return ((res*(unA*res+unC*unB)+unD*unE)/(res*(unA*res+unB)+unD*unF))-unE/unF;
|
||||
}
|
||||
vec3 TonemapUC2( vec3 res )
|
||||
{
|
||||
vec3 ucol = Uch(res);
|
||||
vec3 uwhite = Uch(vec3(unW));
|
||||
return pow(max(ucol/uwhite,0.),vec3(1./2.2));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 coord = TexCoord;
|
||||
vec4 res = texture(InputTexture,coord);
|
||||
vec3 mapped = TonemapUC2(pow(max(res.rgb*texposure,0.),vec3(2.2)));
|
||||
res.rgb = mix(res.rgb,mapped,tblend);
|
||||
FragColor = res;
|
||||
}
|
||||
|
|
@ -65,6 +65,43 @@ Class MariFXHandler : StaticEventHandler
|
|||
Shader.SetEnabled(p,"mfx_dirt",mfx_dirtenable);
|
||||
Shader.SetUniform1f(p,"mfx_dirt","dirtmc",mfx_dirtmc);
|
||||
Shader.SetUniform1f(p,"mfx_dirt","dirtcfactor",mfx_dirtcfactor);
|
||||
// TONEMAP
|
||||
switch ( mfx_tenable )
|
||||
{
|
||||
case 1:
|
||||
Shader.SetEnabled(p,"mfx_tonemap_reinhard",true);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_uc2",false);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_hejldawson",false);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_reinhard","texposure",mfx_texposure);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_reinhard","tblend",mfx_tblend);
|
||||
break;
|
||||
case 2:
|
||||
Shader.SetEnabled(p,"mfx_tonemap_reinhard",false);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_uc2",true);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_hejldawson",false);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","texposure",mfx_texposure);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","tblend",mfx_tblend);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unA",mfx_una);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unB",mfx_unb);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unC",mfx_unc);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unD",mfx_und);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unE",mfx_une);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unF",mfx_unf);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_uc2","unW",mfx_unw);
|
||||
break;
|
||||
case 3:
|
||||
Shader.SetEnabled(p,"mfx_tonemap_reinhard",false);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_uc2",false);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_hejldawson",true);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_hejldawson","texposure",mfx_texposure);
|
||||
Shader.SetUniform1f(p,"mfx_tonemap_hejldawson","tblend",mfx_tblend);
|
||||
break;
|
||||
default:
|
||||
Shader.SetEnabled(p,"mfx_tonemap_reinhard",false);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_uc2",false);
|
||||
Shader.SetEnabled(p,"mfx_tonemap_hejldawson",false);
|
||||
break;
|
||||
}
|
||||
// COLOR GRADING
|
||||
Shader.SetEnabled(p,"mfx_grading",mfx_gradeenable);
|
||||
Shader.SetUniform3f(p,"mfx_grading","grademul",(mfx_grademul_r,mfx_grademul_g,mfx_grademul_b));
|
||||
|
|
@ -389,6 +426,18 @@ Class MariFXHandler : StaticEventHandler
|
|||
case 11:
|
||||
CVar.FindCVar('mfx_paintenable').ResetToDefault();
|
||||
break;
|
||||
case 12:
|
||||
CVar.FindCVar('mfx_tenable').ResetToDefault();
|
||||
CVar.FindCVar('mfx_texposure').ResetToDefault();
|
||||
CVar.FindCVar('mfx_tblend').ResetToDefault();
|
||||
CVar.FindCVar('mfx_una').ResetToDefault();
|
||||
CVar.FindCVar('mfx_unb').ResetToDefault();
|
||||
CVar.FindCVar('mfx_unc').ResetToDefault();
|
||||
CVar.FindCVar('mfx_und').ResetToDefault();
|
||||
CVar.FindCVar('mfx_une').ResetToDefault();
|
||||
CVar.FindCVar('mfx_unf').ResetToDefault();
|
||||
CVar.FindCVar('mfx_unw').ResetToDefault();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue