diff --git a/Logo_ZDF.png b/Logo_ZDF.png new file mode 100644 index 0000000..95e6cc4 Binary files /dev/null and b/Logo_ZDF.png differ diff --git a/README.md b/README.md index 6b46fb5..2b2c037 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,52 @@ ![logo](Logo_Small.png) -Various fancy shaders for GZDoom. +Various fancy shaders for GZDoom ported from MariENB. -Included: - - Luma Sharpen. - - Color Grading suite. - - Color Matrix. - - Hue-Saturation. - - BlurSharpShift. - - Film Grain. - - Screen Dirt. - - Vignette. - - Palette reduction+dither from RetroFX (has doom, heretic, hexen and strife palettes). +### Luma Sharpen + +Boosts small details. Doesn't cause noticeable halos like a typical sharpening +filter. + +### 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). + +### Color Matrix + +General purpose color mixing. The matrix is normalized in post. For experienced +users. + +### Hue-Saturation + +The GIMP filter in shader form. Allows shifting the hue and tweaking the +saturation and value of red, yellow, green, cyan, blue and magenta ranges. + +### BlurSharpShift + +Blurring followed by sharpening, followed by chromatic aberration. This is a +meme filter chain that a lot of people love for some reason, claiming it adds +"photorealism" or something. + +### Grain + +Makes the screen fuzzy. A couple parameters can be tweaked freely. + +### Screen Dirt + +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. + +### Vignette + +Darkens the edges of the screen. Comes with "border blur", which also blurs +said edges. + +### Palette Reduction w/ Dither + +Part of the "Retro FX" megashader from old MariENB versions. Does what it says +on the tin. There's a multitude of palettes available to choose from. Most +IWADs are covered, along with some notable megawads, various DOS games, and a +couple "standard" palettes. diff --git a/cvarinfo.txt b/cvarinfo.txt index 311c2c8..80c2c1d 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -5,10 +5,14 @@ user float mfx_lsharpblend = 6.0; user bool mfx_ne = false; user float mfx_ni = 0.05; +user float mfx_ns = 0.0; +user float mfx_np = 4.0; +user float mfx_bnp = 1.5; +user int mfx_nb = 2; user bool mfx_dirtenable = false; user float mfx_dirtcfactor = 0.05; -user float mfx_dirtmc = 3.0; +user float mfx_dirtmc = 4.0; user bool mfx_gradeenable = false; user float mfx_grademul_r = 1.0; @@ -70,19 +74,21 @@ user bool mfx_bssshiftenable = false; user float mfx_bssshiftradius = 0.75; user bool mfx_bblurenable = false; -user float mfx_bblurpow = 2.0; -user float mfx_bblurmul = 1.5; -user float mfx_bblurbump = -0.5; +user float mfx_bblurpow = 1.0; +user float mfx_bblurmul = 1.0; +user float mfx_bblurbump = 0.0; user float mfx_bblurradius = 1.0; user bool mfx_vigenable = false; -user float mfx_vigcolor_r = -1.0; -user float mfx_vigcolor_g = -1.0; -user float mfx_vigcolor_b = -1.0; -user float mfx_vigpow = 3.0; -user float mfx_vigmul = 0.65; +user float mfx_vigcolor_r = 0.0; +user float mfx_vigcolor_g = 0.0; +user float mfx_vigcolor_b = 0.0; +user float mfx_vigpow = 4.0; +user float mfx_vigmul = 0.75; user float mfx_vigbump = 0.0; +user int mfx_vigshape = 1; +user int mfx_vigmode = 0; user bool mfx_palenable = false; -user int mfx_palnum = 1; +user int mfx_palnum = 0; user float mfx_paldither = 0.05; diff --git a/gldefs.txt b/gldefs.txt index 5ae2b3f..977e478 100644 --- a/gldefs.txt +++ b/gldefs.txt @@ -82,10 +82,15 @@ HardwareShader postprocess scene { Name "mfx_borderblur" Shader "shaders/glsl/mfx_borderblur.fp" 330 + Uniform float vigpow + Uniform float vigmul + Uniform float vigbump + Uniform int vigshape Uniform float bblurpow Uniform float bblurmul Uniform float bblurbump Uniform float bblurradius + Texture VignetteTexture "textures/mfxvig.png" } HardwareShader postprocess scene @@ -94,6 +99,10 @@ HardwareShader postprocess scene Shader "shaders/glsl/mfx_grain.fp" 330 Uniform float Timer Uniform float ni + Uniform float ns + Uniform float np + Uniform float bnp + Uniform int nb Texture NoiseTexture "textures/mfxnoise.png" } @@ -103,7 +112,7 @@ HardwareShader postprocess scene Shader "shaders/glsl/mfx_dirt.fp" 330 Uniform float dirtcfactor Uniform float dirtmc - Texture NoiseTexture "textures/mfxnoise.png" + Texture NoiseTexture "textures/mfxdirt.png" } HardwareShader postprocess scene @@ -114,6 +123,9 @@ HardwareShader postprocess scene Uniform float vigpow Uniform float vigmul Uniform float vigbump + Uniform int vigshape + Uniform int vigmode + Texture VignetteTexture "textures/mfxvig.png" } HardwareShader postprocess scene diff --git a/menudef.txt b/menudef.txt index c8d91a4..421c27d 100644 --- a/menudef.txt +++ b/menudef.txt @@ -4,6 +4,27 @@ AddOptionMenu "OptionsMenu" SubMenu "MariFX Options", "MFXOptionsMenu" } +OptionValue "MFXGrainBlend" +{ + 0, "Add" + 1, "Overlay" + 2, "Dark Mask" +} + +OptionValue "MFXVigShape" +{ + 0, "Circle" + 1, "Box" + 2, "Texture" +} + +OptionValue "MFXVigMode" +{ + 0, "Translucent" + 1, "Add" + 2, "Multiply" +} + OptionValue "MFXPalette" { 0, "Doom" @@ -50,12 +71,16 @@ OptionMenu "MFXOptionsMenu" Slider "Sharpen Radius", "mfx_lsharpradius", 0, 1, 0.01, 2 Slider "Sharpen Threshold", "mfx_lsharpclamp", 0, 1, 0.01, 2 Slider "Sharpen Strength", "mfx_lsharpblend", 0, 8, 0.1, 1 - Command "Reset to Default", "event resetmfxvars 9" + Command "Reset to Default", "event resetmfxvars 8" StaticText " " StaticText "Film Grain", "Gold" StaticText " " Option "Enable", "mfx_ne", "YesNo" Slider "Grain Intensity", "mfx_ni", 0, 1, 0.01, 2 + Slider "Grain Saturation", "mfx_ns", -1, 1, 0.01, 2 + Slider "Grain Contrast", "mfx_np", 0.5, 4, 0.01, 2 + Option "Grain Blend Mode", "mfx_nb", "MFXGrainBlend" + Slider "Grain Dark Mask Contrast", "mfx_bnp", 0.5, 8, 0.01, 2 Command "Reset to Default", "event resetmfxvars 0" StaticText " " StaticText "Screen Dirt", "Gold" @@ -139,30 +164,28 @@ OptionMenu "MFXOptionsMenu" Slider "Shift Radius", "mfx_bssshiftradius", 0, 1, 0.05, 2 Command "Reset to Default", "event resetmfxvars 5" StaticText " " - StaticText "Border Blur", "Gold" + StaticText "Vignette / Border Blur", "Gold" StaticText " " - Option "Enable", "mfx_bblurenable", "YesNo" - Slider "Blur Gamma", "mfx_bblurpow", 0, 4, 0.01, 2 - Slider "Blur Intensity", "mfx_bblurmul", 0, 2, 0.01, 2 - Slider "Blur Offset", "mfx_bblurbump", -1, 1, 0.01, 2 - Slider "Blur Radius", "mfx_bblurradius", 0, 4, 0.01, 2 - Command "Reset to Default", "event resetmfxvars 6" - StaticText " " - StaticText "Vignette", "Gold" - StaticText " " - Option "Enable", "mfx_vigenable", "YesNo" + Option "Enable Vignette", "mfx_vigenable", "YesNo" Slider "Vignette Red", "mfx_vigcolor_r", -1, 1, 0.01, 2 Slider "Vignette Green", "mfx_vigcolor_g", -1, 1, 0.01, 2 Slider "Vignette Blue", "mfx_vigcolor_b", -1, 1, 0.01, 2 Slider "Vignette Gamma", "mfx_vigpow", 0, 4, 0.01, 2 Slider "Vignette Intensity", "mfx_vigmul", 0, 2, 0.01, 2 Slider "Vignette Offset", "mfx_vigbump", -1, 1, 0.01, 2 - Command "Reset to Default", "event resetmfxvars 7" + Option "Vignette Shape", "mfx_vigshape", "MFXVigShape" + Option "Vignette Mode", "mfx_vigmode", "MFXVigMode" + Option "Enable Blur", "mfx_bblurenable", "YesNo" + Slider "Blur Gamma", "mfx_bblurpow", 0, 4, 0.01, 2 + Slider "Blur Intensity", "mfx_bblurmul", 0, 2, 0.01, 2 + Slider "Blur Offset", "mfx_bblurbump", -1, 1, 0.01, 2 + Slider "Blur Radius", "mfx_bblurradius", 0, 4, 0.01, 2 + Command "Reset to Default", "event resetmfxvars 6" StaticText " " StaticText "Palette", "Gold" StaticText " " Option "Enable", "mfx_palenable", "YesNo" Option "Palette", "mfx_palnum", "MFXPalette" Slider "Dithering", "mfx_paldither", 0, 1, 0.01, 2 - Command "Reset to Default", "event resetmfxvars 8" + Command "Reset to Default", "event resetmfxvars 7" } diff --git a/shaders/glsl/mfx_borderblur.fp b/shaders/glsl/mfx_borderblur.fp index 435b6e2..636612e 100644 --- a/shaders/glsl/mfx_borderblur.fp +++ b/shaders/glsl/mfx_borderblur.fp @@ -1,11 +1,26 @@ +/* + Border blur from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { float gauss4[4] = { 0.270682, 0.216745, 0.111281, 0.036633 }; vec2 coord = TexCoord; vec4 res = texture(InputTexture,coord); vec2 bresl = textureSize(InputTexture,0); - vec2 uv = ((coord-0.5)*vec2(1.0,bresl.y/bresl.x))*2.0; - float bfact = clamp(pow(dot(uv,uv),bblurpow)*bblurmul+bblurbump,0.0,1.0); + float vigdata = 0.0; + if ( vigshape == 0 ) + { + vec2 uv = ((coord-0.5)*vec2(1.0,bresl.y/bresl.x))*2.0; + vigdata = clamp(pow(dot(uv,uv),vigpow)*vigmul+vigbump,0.0,1.0); + } + else if ( vigshape == 1 ) + { + vec2 uv = coord.xy*(1.0-coord.yx)*4.0; + vigdata = clamp(pow(max(1.0-(uv.x*uv.y),0.0),vigpow)*vigmul+vigbump,0.0,1.0); + } + else vigdata = texture(VignetteTexture,coord).a; + float bfact = clamp(pow(max(vigdata,0.0),bblurpow)*bblurmul+bblurbump,0.0,1.0); vec2 bof = (1.0/bresl)*bblurradius*bfact; res.rgb *= 0; int i,j; diff --git a/shaders/glsl/mfx_bss_blur.fp b/shaders/glsl/mfx_bss_blur.fp index 865b70b..995417b 100644 --- a/shaders/glsl/mfx_bss_blur.fp +++ b/shaders/glsl/mfx_bss_blur.fp @@ -1,3 +1,7 @@ +/* + BlurSharpShift blur from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { vec2 coord = TexCoord; diff --git a/shaders/glsl/mfx_bss_sharp.fp b/shaders/glsl/mfx_bss_sharp.fp index 0b2cfc5..1877786 100644 --- a/shaders/glsl/mfx_bss_sharp.fp +++ b/shaders/glsl/mfx_bss_sharp.fp @@ -1,3 +1,7 @@ +/* + BlurSharpShift sharpen from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { vec2 coord = TexCoord; diff --git a/shaders/glsl/mfx_bss_shift.fp b/shaders/glsl/mfx_bss_shift.fp index 2a6b288..31fcf39 100644 --- a/shaders/glsl/mfx_bss_shift.fp +++ b/shaders/glsl/mfx_bss_shift.fp @@ -1,3 +1,7 @@ +/* + BlurSharpShift shift from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { vec2 coord = TexCoord; diff --git a/shaders/glsl/mfx_colormatrix.fp b/shaders/glsl/mfx_colormatrix.fp index 9e106cf..840cefb 100644 --- a/shaders/glsl/mfx_colormatrix.fp +++ b/shaders/glsl/mfx_colormatrix.fp @@ -1,3 +1,7 @@ +/* + Simple color matrix from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { vec2 coord = TexCoord; diff --git a/shaders/glsl/mfx_dirt.fp b/shaders/glsl/mfx_dirt.fp index 3f57ead..9d548f3 100644 --- a/shaders/glsl/mfx_dirt.fp +++ b/shaders/glsl/mfx_dirt.fp @@ -1,9 +1,14 @@ +/* + Dirty camera effect from MariENB + (C)2012-2019 Marisa Kirisame +*/ vec3 lensdirt( in vec3 res, in vec2 coord ) { - vec2 nr = textureSize(InputTexture,0)/textureSize(NoiseTexture,0); - vec3 ncolc = texture(NoiseTexture,coord*dirtmc*nr).rgb; + vec2 bresl = textureSize(InputTexture,0); + vec2 nr = vec2(1.0,bresl.y/bresl.x); + float ncol = texture(NoiseTexture,coord*dirtmc*nr).x; vec2 ds = vec2(res.r+res.g,res.g+res.b)/2.0; - res = mix(res,(ncolc.r+1.0)*res,dirtcfactor*clamp(1.0-(ds.x+ds.y)*0.25,0.0,1.0)); + res = mix(res,(ncol+1.0)*res,dirtcfactor*clamp(1.0-(ds.x+ds.y)*0.25,0.0,1.0)); return res; } diff --git a/shaders/glsl/mfx_grading.fp b/shaders/glsl/mfx_grading.fp index b10ede4..d1733d3 100644 --- a/shaders/glsl/mfx_grading.fp +++ b/shaders/glsl/mfx_grading.fp @@ -1,4 +1,7 @@ -/* math color grading from MariFX */ +/* + Math color grading from MariENB + (C)2012-2019 Marisa Kirisame +*/ #define luminance(x) dot(x,vec3(0.2126,0.7152,0.0722)) vec3 rgb2hsv( vec3 c ) diff --git a/shaders/glsl/mfx_grain.fp b/shaders/glsl/mfx_grain.fp index 19a713d..0ee22e4 100644 --- a/shaders/glsl/mfx_grain.fp +++ b/shaders/glsl/mfx_grain.fp @@ -1,15 +1,13 @@ /* Complex grain shader ported over from MariENB - (C)2012-2018 Marisa Kirisame + (C)2012-2019 Marisa Kirisame */ -const float nf = 0.000005; +const float nf = 0.0005; const vec3 nm1 = vec3(2.05,3.11,2.22); const float nk = 0.04; const vec3 nm2 = vec3(4.25,9.42,6.29); -const float ns = -0.08; -const float np = 3.95; -const float bnp = 1.7; +#define overlay(a,b) (a<0.5)?(2.0*a*b):(1.0-(2.0*(1.0-a)*(1.0-b))) #define darkmask(a,b) (a>0.5)?(2.0*a*(0.5+b)):(1.0-2.0*(1.0-a)*(1.0-((0.5+b)))) vec3 grain( in vec3 res, in vec2 coord ) @@ -19,7 +17,9 @@ vec3 grain( in vec3 res, in vec2 coord ) vec2 s2 = coord+vec2(ts,0.0); vec2 s3 = coord+vec2(ts,ts); float n1, n2, n3; - vec2 nr = textureSize(NoiseTexture,0); + vec2 bresl = textureSize(InputTexture,0); + vec2 nr = vec2(7.5); + nr.y *= bresl.y/bresl.x; n1 = texture(NoiseTexture,s1*nm1.x*nr).r; n2 = texture(NoiseTexture,s2*nm1.y*nr).g; n3 = texture(NoiseTexture,s3*nm1.z*nr).b; @@ -33,12 +33,22 @@ vec3 grain( in vec3 res, in vec2 coord ) vec3 ng = vec3(n4); vec3 nc = vec3(n1,n2,n3); vec3 nt = pow(clamp(mix(ng,nc,ns),0.0,1.0),vec3(np)); - float bn = 1.0-clamp((res.r+res.g+res.b)/3.0,0.0,1.0); - bn = pow(bn,bnp); - vec3 nn = clamp(nt*bn,vec3(0.0),vec3(1.0)); - res.r = darkmask(res.r,(nn.r*ni)); - res.g = darkmask(res.g,(nn.g*ni)); - res.b = darkmask(res.b,(nn.b*ni)); + if ( nb == 0 ) res.rgb += nt*ni; + else if ( nb == 1 ) + { + res.r = overlay(res.r,(nt.r*ni+0.5)); + res.g = overlay(res.g,(nt.g*ni+0.5)); + res.b = overlay(res.b,(nt.b*ni+0.5)); + } + else + { + float bn = 1.0-clamp((res.r+res.g+res.b)/3.0,0.0,1.0); + bn = pow(bn,bnp); + vec3 nn = clamp(nt*bn,vec3(0.0),vec3(1.0)); + res.r = darkmask(res.r,(nn.r*ni)); + res.g = darkmask(res.g,(nn.g*ni)); + res.b = darkmask(res.b,(nn.b*ni)); + } return res; } diff --git a/shaders/glsl/mfx_huesaturation.fp b/shaders/glsl/mfx_huesaturation.fp index 9579a83..d7f44cb 100644 --- a/shaders/glsl/mfx_huesaturation.fp +++ b/shaders/glsl/mfx_huesaturation.fp @@ -1,3 +1,8 @@ +/* + Hue-Saturation filter from MariENB, ported over from GIMP + (C)2007 Michael Natterer + (C)2012-2019 Marisa Kirisame +*/ vec3 rgb2hsv( vec3 c ) { vec4 K = vec4(0.0,-1.0/3.0,2.0/3.0,-1.0); diff --git a/shaders/glsl/mfx_lumasharp.fp b/shaders/glsl/mfx_lumasharp.fp index 1dcb5f5..5c4a326 100644 --- a/shaders/glsl/mfx_lumasharp.fp +++ b/shaders/glsl/mfx_lumasharp.fp @@ -1,3 +1,7 @@ +/* + LumaSharpen from MariENB + (C)2012-2019 Marisa Kirisame +*/ #define luminance(x) dot(x,vec3(0.2126,0.7152,0.0722)) void main() diff --git a/shaders/glsl/mfx_palette.fp b/shaders/glsl/mfx_palette.fp index 41a2d01..536d414 100644 --- a/shaders/glsl/mfx_palette.fp +++ b/shaders/glsl/mfx_palette.fp @@ -1,3 +1,7 @@ +/* + RetroFX palette reduction from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { #define d(x) x/64.0 @@ -16,7 +20,13 @@ void main() vec2 coord = TexCoord; vec2 sfact = textureSize(InputTexture,0); vec4 res = texture(InputTexture,coord); - res.rgb += paldither*dither8[int(coord.x*sfact.x)%8+int(coord.y*sfact.y)%8*8]-paldither*0.5; + if ( res.r <= 0.0 ) res.r -= paldither; + if ( res.g <= 0.0 ) res.g -= paldither; + if ( res.b <= 0.0 ) res.b -= paldither; + if ( res.r >= 1.0 ) res.r += paldither; + if ( res.g >= 1.0 ) res.g += paldither; + if ( res.b >= 1.0 ) res.b += paldither; + res.rgb += paldither*dither8[int(coord.x*sfact.x)%8+int(coord.y*sfact.y)%8*8]-0.5*paldither; vec3 lc = clamp(floor(res.rgb*64),0,63); ivec2 lcoord = ivec2(lc.r,lc.g+lc.b*64); lcoord.x += 64*palnum; diff --git a/shaders/glsl/mfx_vignette.fp b/shaders/glsl/mfx_vignette.fp index 8141cf2..989393b 100644 --- a/shaders/glsl/mfx_vignette.fp +++ b/shaders/glsl/mfx_vignette.fp @@ -1,11 +1,28 @@ +/* + Vignette filter from MariENB + (C)2012-2019 Marisa Kirisame +*/ void main() { vec2 coord = TexCoord; vec4 res = texture(InputTexture,coord); vec2 bresl = textureSize(InputTexture,0); - vec2 uv = ((coord-0.5)*vec2(1.0,bresl.y/bresl.x))*2.0; - vec4 vigdata = vec4(vigcolor,clamp(pow(dot(uv,uv),vigpow)*vigmul+vigbump,0.0,1.0)); - vec3 outcol = clamp(res.rgb+vigdata.rgb,0.0,1.0); - res.rgb = mix(res.rgb,outcol,vigdata.a); + vec4 vigdata = vec4(0.0); + if ( vigshape == 0 ) + { + vec2 uv = ((coord-0.5)*vec2(1.0,bresl.y/bresl.x))*2.0; + vigdata = vec4(vigcolor,clamp(pow(dot(uv,uv),vigpow)*vigmul+vigbump,0.0,1.0)); + } + else if ( vigshape == 1 ) + { + vec2 uv = coord.xy*(1.0-coord.yx)*4.0; + vigdata = vec4(vigcolor,clamp(pow(max(1.0-(uv.x*uv.y),0.0),vigpow)*vigmul+vigbump,0.0,1.0)); + } + else vigdata = texture(VignetteTexture,coord); + vec3 outcol; + if ( vigmode == 0 ) outcol = vigdata.rgb; + else if ( vigmode == 1 ) outcol = res.rgb+vigdata.rgb; + else outcol = res.rgb*vigdata.rgb; + res.rgb = mix(res.rgb,clamp(outcol,0.0,1.0),vigdata.a); FragColor = res; } diff --git a/textures/mfxdirt.png b/textures/mfxdirt.png new file mode 100644 index 0000000..6ba3370 Binary files /dev/null and b/textures/mfxdirt.png differ diff --git a/textures/mfxvig.png b/textures/mfxvig.png new file mode 100644 index 0000000..a05f8fc Binary files /dev/null and b/textures/mfxvig.png differ diff --git a/zscript.txt b/zscript.txt index 660497b..bea78fb 100644 --- a/zscript.txt +++ b/zscript.txt @@ -6,7 +6,7 @@ Class MariFXHandler : StaticEventHandler transient ui CVar mfx_lsharpenable, mfx_lsharpradius, mfx_lsharpclamp, mfx_lsharpblend, // noise - mfx_ne, mfx_ni, + mfx_ne, mfx_ni, mfx_ns, mfx_np, mfx_bnp, mfx_nb, // dirt mfx_dirtenable, mfx_dirtcfactor, mfx_dirtmc, // grading @@ -23,6 +23,7 @@ Class MariFXHandler : StaticEventHandler mfx_vigenable, mfx_bblurenable, mfx_vigpow, mfx_vigmul, mfx_vigbump, mfx_vigcolor_r, mfx_vigcolor_g, mfx_vigcolor_b, mfx_bblurpow, mfx_bblurmul, mfx_bblurbump, mfx_bblurradius, + mfx_vigshape, mfx_vigmode, // color matrix mfx_cmatenable, mfx_cmat_rr, mfx_cmat_rg, mfx_cmat_rb, mfx_cmat_gr, mfx_cmat_gg, mfx_cmat_gb, mfx_cmat_br, @@ -50,8 +51,16 @@ Class MariFXHandler : StaticEventHandler Shader.SetUniform1f(p,"mfx_lumasharp","sharpblend",mfx_lsharpblend.GetFloat()); if ( !mfx_ne ) mfx_ne = CVar.GetCVar('mfx_ne',p); if ( !mfx_ni ) mfx_ni = CVar.GetCVar('mfx_ni',p); + if ( !mfx_ns ) mfx_ns = CVar.GetCVar('mfx_ns',p); + if ( !mfx_np ) mfx_np = CVar.GetCVar('mfx_np',p); + if ( !mfx_bnp ) mfx_bnp = CVar.GetCVar('mfx_bnp',p); + if ( !mfx_nb ) mfx_nb = CVar.GetCVar('mfx_nb',p); Shader.SetEnabled(p,"mfx_grain",mfx_ne.GetBool()); Shader.SetUniform1f(p,"mfx_grain","ni",mfx_ni.GetFloat()); + Shader.SetUniform1f(p,"mfx_grain","ns",mfx_ns.GetFloat()); + Shader.SetUniform1f(p,"mfx_grain","np",mfx_np.GetFloat()); + Shader.SetUniform1f(p,"mfx_grain","bnp",mfx_bnp.GetFloat()); + Shader.SetUniform1i(p,"mfx_grain","nb",mfx_nb.GetInt()); Shader.SetUniform1f(p,"mfx_grain","Timer",(gametic+e.fractic)/35.); if ( !mfx_dirtenable ) mfx_dirtenable = CVar.GetCVar('mfx_dirtenable',p); if ( !mfx_dirtmc ) mfx_dirtmc = CVar.GetCVar('mfx_dirtmc',p); @@ -157,16 +166,6 @@ Class MariFXHandler : StaticEventHandler Shader.SetUniform1f(p,"mfx_bss_sharp","bsssharpamount",mfx_bsssharpamount.GetFloat()); Shader.SetEnabled(p,"mfx_bss_shift",mfx_bssshiftenable.GetBool()); Shader.SetUniform1f(p,"mfx_bss_shift","bssshiftradius",mfx_bssshiftradius.GetFloat()); - if ( !mfx_bblurenable ) mfx_bblurenable = CVar.GetCVar('mfx_bblurenable',p); - if ( !mfx_bblurpow ) mfx_bblurpow = CVar.GetCVar('mfx_bblurpow',p); - if ( !mfx_bblurmul ) mfx_bblurmul = CVar.GetCVar('mfx_bblurmul',p); - if ( !mfx_bblurbump ) mfx_bblurbump = CVar.GetCVar('mfx_bblurbump',p); - if ( !mfx_bblurradius ) mfx_bblurradius = CVar.GetCVar('mfx_bblurradius',p); - Shader.SetEnabled(p,"mfx_borderblur",mfx_bblurenable.GetBool()); - Shader.SetUniform1f(p,"mfx_borderblur","bblurpow",mfx_bblurpow.GetFloat()); - Shader.SetUniform1f(p,"mfx_borderblur","bblurmul",mfx_bblurmul.GetFloat()); - Shader.SetUniform1f(p,"mfx_borderblur","bblurbump",mfx_bblurbump.GetFloat()); - Shader.SetUniform1f(p,"mfx_borderblur","bblurradius",mfx_bblurradius.GetFloat()); if ( !mfx_vigenable ) mfx_vigenable = CVar.GetCVar('mfx_vigenable',p); if ( !mfx_vigcolor_r ) mfx_vigcolor_r = CVar.GetCVar('mfx_vigcolor_r',p); if ( !mfx_vigcolor_g ) mfx_vigcolor_g = CVar.GetCVar('mfx_vigcolor_g',p); @@ -174,11 +173,29 @@ Class MariFXHandler : StaticEventHandler if ( !mfx_vigpow ) mfx_vigpow = CVar.GetCVar('mfx_vigpow',p); if ( !mfx_vigmul ) mfx_vigmul = CVar.GetCVar('mfx_vigmul',p); if ( !mfx_vigbump ) mfx_vigbump = CVar.GetCVar('mfx_vigbump',p); + if ( !mfx_bblurenable ) mfx_bblurenable = CVar.GetCVar('mfx_bblurenable',p); + if ( !mfx_bblurpow ) mfx_bblurpow = CVar.GetCVar('mfx_bblurpow',p); + if ( !mfx_bblurmul ) mfx_bblurmul = CVar.GetCVar('mfx_bblurmul',p); + if ( !mfx_bblurbump ) mfx_bblurbump = CVar.GetCVar('mfx_bblurbump',p); + if ( !mfx_bblurradius ) mfx_bblurradius = CVar.GetCVar('mfx_bblurradius',p); + if ( !mfx_vigshape ) mfx_vigshape = CVar.GetCVar('mfx_vigshape',p); + if ( !mfx_vigmode ) mfx_vigmode = CVar.GetCVar('mfx_vigmode',p); + Shader.SetEnabled(p,"mfx_borderblur",mfx_bblurenable.GetBool()); + Shader.SetUniform1f(p,"mfx_borderblur","vigpow",mfx_vigpow.GetFloat()); + Shader.SetUniform1f(p,"mfx_borderblur","vigmul",mfx_vigmul.GetFloat()); + Shader.SetUniform1f(p,"mfx_borderblur","vigbump",mfx_vigbump.GetFloat()); + Shader.SetUniform1i(p,"mfx_borderblur","vigshape",mfx_vigshape.GetInt()); + Shader.SetUniform1f(p,"mfx_borderblur","bblurpow",mfx_bblurpow.GetFloat()); + Shader.SetUniform1f(p,"mfx_borderblur","bblurmul",mfx_bblurmul.GetFloat()); + Shader.SetUniform1f(p,"mfx_borderblur","bblurbump",mfx_bblurbump.GetFloat()); + Shader.SetUniform1f(p,"mfx_borderblur","bblurradius",mfx_bblurradius.GetFloat()); Shader.SetEnabled(p,"mfx_vignette",mfx_vigenable.GetBool()); Shader.SetUniform3f(p,"mfx_vignette","vigcolor",(mfx_vigcolor_r.GetFloat(),mfx_vigcolor_g.GetFloat(),mfx_vigcolor_b.GetFloat())); Shader.SetUniform1f(p,"mfx_vignette","vigpow",mfx_vigpow.GetFloat()); Shader.SetUniform1f(p,"mfx_vignette","vigmul",mfx_vigmul.GetFloat()); Shader.SetUniform1f(p,"mfx_vignette","vigbump",mfx_vigbump.GetFloat()); + Shader.SetUniform1i(p,"mfx_vignette","vigshape",mfx_vigshape.GetInt()); + Shader.SetUniform1i(p,"mfx_vignette","vigmode",mfx_vigmode.GetInt()); if ( !mfx_palenable ) mfx_palenable = CVar.GetCVar('mfx_palenable',p); if ( !mfx_palnum ) mfx_palnum = CVar.GetCVar('mfx_palnum',p); if ( !mfx_paldither ) mfx_paldither = CVar.GetCVar('mfx_paldither',p); @@ -196,8 +213,16 @@ Class MariFXHandler : StaticEventHandler case 0: if ( !mfx_ne ) mfx_ne = CVar.GetCVar('mfx_ne',p); if ( !mfx_ni ) mfx_ni = CVar.GetCVar('mfx_ni',p); + if ( !mfx_ns ) mfx_ns = CVar.GetCVar('mfx_ns',p); + if ( !mfx_np ) mfx_np = CVar.GetCVar('mfx_np',p); + if ( !mfx_bnp ) mfx_bnp = CVar.GetCVar('mfx_bnp',p); + if ( !mfx_nb ) mfx_nb = CVar.GetCVar('mfx_nb',p); mfx_ne.ResetToDefault(); mfx_ni.ResetToDefault(); + mfx_ns.ResetToDefault(); + mfx_np.ResetToDefault(); + mfx_bnp.ResetToDefault(); + mfx_nb.ResetToDefault(); break; case 1: if ( !mfx_dirtenable ) mfx_dirtenable = CVar.GetCVar('mfx_dirtenable',p); @@ -326,6 +351,15 @@ Class MariFXHandler : StaticEventHandler mfx_bssshiftradius.ResetToDefault(); break; case 6: + if ( !mfx_vigenable ) mfx_vigenable = CVar.GetCVar('mfx_vigenable',p); + if ( !mfx_vigcolor_r ) mfx_vigcolor_r = CVar.GetCVar('mfx_vigcolor_r',p); + if ( !mfx_vigcolor_g ) mfx_vigcolor_g = CVar.GetCVar('mfx_vigcolor_g',p); + if ( !mfx_vigcolor_b ) mfx_vigcolor_b = CVar.GetCVar('mfx_vigcolor_b',p); + if ( !mfx_vigpow ) mfx_vigpow = CVar.GetCVar('mfx_vigpow',p); + if ( !mfx_vigmul ) mfx_vigmul = CVar.GetCVar('mfx_vigmul',p); + if ( !mfx_vigbump ) mfx_vigbump = CVar.GetCVar('mfx_vigbump',p); + if ( !mfx_vigshape ) mfx_vigshape = CVar.GetCVar('mfx_vigshape',p); + if ( !mfx_vigmode ) mfx_vigmode = CVar.GetCVar('mfx_vigmode',p); if ( !mfx_bblurenable ) mfx_bblurenable = CVar.GetCVar('mfx_bblurenable',p); if ( !mfx_bblurpow ) mfx_bblurpow = CVar.GetCVar('mfx_bblurpow',p); if ( !mfx_bblurmul ) mfx_bblurmul = CVar.GetCVar('mfx_bblurmul',p); @@ -336,15 +370,6 @@ Class MariFXHandler : StaticEventHandler mfx_bblurmul.ResetToDefault(); mfx_bblurbump.ResetToDefault(); mfx_bblurradius.ResetToDefault(); - break; - case 7: - if ( !mfx_vigenable ) mfx_vigenable = CVar.GetCVar('mfx_vigenable',p); - if ( !mfx_vigcolor_r ) mfx_vigcolor_r = CVar.GetCVar('mfx_vigcolor_r',p); - if ( !mfx_vigcolor_g ) mfx_vigcolor_g = CVar.GetCVar('mfx_vigcolor_g',p); - if ( !mfx_vigcolor_b ) mfx_vigcolor_b = CVar.GetCVar('mfx_vigcolor_b',p); - if ( !mfx_vigpow ) mfx_vigpow = CVar.GetCVar('mfx_vigpow',p); - if ( !mfx_vigmul ) mfx_vigmul = CVar.GetCVar('mfx_vigmul',p); - if ( !mfx_vigbump ) mfx_vigbump = CVar.GetCVar('mfx_vigbump',p); mfx_vigenable.ResetToDefault(); mfx_vigcolor_r.ResetToDefault(); mfx_vigcolor_g.ResetToDefault(); @@ -352,8 +377,10 @@ Class MariFXHandler : StaticEventHandler mfx_vigpow.ResetToDefault(); mfx_vigmul.ResetToDefault(); mfx_vigbump.ResetToDefault(); + mfx_vigshape.ResetToDefault(); + mfx_vigmode.ResetToDefault(); break; - case 8: + case 7: if ( !mfx_palenable ) mfx_palenable = CVar.GetCVar('mfx_palenable',p); if ( !mfx_palnum ) mfx_palnum = CVar.GetCVar('mfx_palnum',p); if ( !mfx_paldither ) mfx_paldither = CVar.GetCVar('mfx_paldither',p); @@ -361,6 +388,16 @@ Class MariFXHandler : StaticEventHandler mfx_palnum.ResetToDefault(); mfx_paldither.ResetToDefault(); break; + case 8: + if ( !mfx_lsharpenable ) mfx_lsharpenable = CVar.GetCVar('mfx_lsharpenable',p); + if ( !mfx_lsharpradius ) mfx_lsharpradius = CVar.GetCVar('mfx_lsharpradius',p); + if ( !mfx_lsharpclamp ) mfx_lsharpclamp = CVar.GetCVar('mfx_lsharpclamp',p); + if ( !mfx_lsharpblend ) mfx_lsharpblend = CVar.GetCVar('mfx_lsharpblend',p); + mfx_lsharpenable.ResetToDefault(); + mfx_lsharpradius.ResetToDefault(); + mfx_lsharpclamp.ResetToDefault(); + mfx_lsharpblend.ResetToDefault(); + break; } } }