From 2c06d30f96ec632fb021c4d0b7b298854c2351a2 Mon Sep 17 00:00:00 2001 From: hunterk Date: Mon, 22 Jul 2019 15:08:52 -0500 Subject: [PATCH] improve reshade bloom; still not perfect but better --- reshade/bloom.slangp | 49 +++++++++-------- reshade/shaders/bloom/BloomPass0.slang | 4 +- reshade/shaders/bloom/BloomPass1.slang | 5 +- reshade/shaders/bloom/BloomPass2.slang | 7 +-- reshade/shaders/bloom/BloomPass3.slang | 3 +- reshade/shaders/bloom/BloomPass4.slang | 5 +- reshade/shaders/bloom/LensFlarePass0.slang | 20 +++---- reshade/shaders/bloom/LightingCombine.slang | 28 +++++----- reshade/shaders/bloom/frag_funcs.inc | 9 ++-- reshade/shaders/bloom/params.inc | 59 +++++++++++++++++---- 10 files changed, 119 insertions(+), 70 deletions(-) diff --git a/reshade/bloom.slangp b/reshade/bloom.slangp index 4805a92..1847f64 100644 --- a/reshade/bloom.slangp +++ b/reshade/bloom.slangp @@ -1,49 +1,52 @@ -shaders = 7 +shaders = 9 shader0 = shaders/bloom/BloomPass0.slang -alias0 = Bloom1 +alias0 = SamplerBloom1 float_framebuffer0 = true shader1 = shaders/bloom/BloomPass1.slang -alias1 = Bloom2 +alias1 = SamplerBloom2 float_framebuffer1 = true shader2 = shaders/bloom/BloomPass2.slang -alias2 = Bloom3 +alias2 = SamplerBloom3 float_framebuffer2 = true scale2 = 0.5 -scale_type2 = source +scale_type2 = viewport shader3 = shaders/bloom/BloomPass3.slang -alias3 = Bloom4 +alias3 = SamplerBloom4 float_framebuffer3 = true -scale3 = 0.5 -scale_type3 = source +scale3 = 0.25 +scale_type3 = viewport shader4 = shaders/bloom/BloomPass4.slang -alias4 = Bloom5 +alias4 = SamplerBloom5 float_framebuffer4 = true -scale4 = 0.5 -scale_type4 = source +scale4 = 0.125 +scale_type4 = viewport shader5 = shaders/bloom/LensFlarePass0.slang alias5 = LensFlare1 float_framebuffer5 = true -scale5 = 4.0 -scale_type5 = source +#scale_type5 = source -#shader6 = shaders/bloom/LensFlarePass1.slang -#alias6 = LensFlare2 -#float_framebuffer6 = true +shader6 = shaders/bloom/LensFlarePass1.slang +alias6 = LensFlare2 +float_framebuffer6 = true +#scale6 = 0.5 +scale_type6 = viewport -#shader7 = shaders/bloom/LensFlarePass2.slang -#alias7 = LensFlare3 -#float_framebuffer7 = true +shader7 = shaders/bloom/LensFlarePass2.slang +alias7 = LensFlare3 +float_framebuffer7 = true +#scale7 = 0.5 +scale_type7 = viewport -shader6 = shaders/bloom/LightingCombine.slang -scale6 = 2.0 -scale_type6 = source -filter_linear6 = true +shader8 = shaders/bloom/LightingCombine.slang +scale8 = 2.0 +scale_type8 = viewport +filter_linear8 = true textures = "Dirt;Sprite" Dirt = shaders/bloom/LensDB.png diff --git a/reshade/shaders/bloom/BloomPass0.slang b/reshade/shaders/bloom/BloomPass0.slang index 905d0cf..a981daf 100755 --- a/reshade/shaders/bloom/BloomPass0.slang +++ b/reshade/shaders/bloom/BloomPass0.slang @@ -44,9 +44,9 @@ void main() for (int i = 0; i < 4; i++) { - bloomuv = offset[i] * (vTexCoord.xy * params.SourceSize.zw) * 2.; + bloomuv = offset[i] * PixelSize * 2.; bloomuv += vTexCoord.xy; - tempbloom = textureLod(Source, vec2(bloomuv.xy), 0.); + tempbloom = textureLod(BackBuffer, vec2(bloomuv.xy), 0.); tempbloom.w = max(0., dot(tempbloom.xyz, vec3(0.333)) - global.fAnamFlareThreshold); tempbloom.xyz = max(vec3(0.), tempbloom.xyz - vec3(global.fBloomThreshold)); bloom += tempbloom; diff --git a/reshade/shaders/bloom/BloomPass1.slang b/reshade/shaders/bloom/BloomPass1.slang index 4801a43..3fd1811 100755 --- a/reshade/shaders/bloom/BloomPass1.slang +++ b/reshade/shaders/bloom/BloomPass1.slang @@ -26,6 +26,7 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 3) uniform sampler2D Original; +layout(set = 0, binding = 4) uniform sampler2D SamplerBloom1; #include "frag_funcs.inc" @@ -46,9 +47,9 @@ void main() for (int i = 0; i < 8; i++) { - vec2 bloomuv = offset[i] * (vTexCoord.xy * params.SourceSize.zw) * 4; + vec2 bloomuv = offset[i] * PixelSize * 4.; bloomuv += vTexCoord; - bloom += textureLod(Source, vec2(bloomuv), 0); + bloom += textureLod(SamplerBloom1, vec2(bloomuv), 0); } bloom *= 0.125; diff --git a/reshade/shaders/bloom/BloomPass2.slang b/reshade/shaders/bloom/BloomPass2.slang index 09330a2..869c080 100755 --- a/reshade/shaders/bloom/BloomPass2.slang +++ b/reshade/shaders/bloom/BloomPass2.slang @@ -26,6 +26,7 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 3) uniform sampler2D Original; +layout(set = 0, binding = 4) uniform sampler2D SamplerBloom2; #include "frag_funcs.inc" @@ -46,11 +47,11 @@ void main() for (int i = 0; i < 8; i++) { - vec2 bloomuv = offset[i] * (vTexCoord.xy * params.SourceSize.zw) * 8.; + vec2 bloomuv = offset[i] * PixelSize * 8.; bloomuv += vTexCoord.xy; - bloom += textureLod(Source, vec2(bloomuv), 0.); + bloom += textureLod(SamplerBloom2, vec2(bloomuv), 0.); } -bloom *= 0.5; // brighten up the sample, it will lose brightness in H/V Gaussian blur + bloom *= 0.5; // brighten up the sample, it will lose brightness in H/V Gaussian blur FragColor = bloom; } \ No newline at end of file diff --git a/reshade/shaders/bloom/BloomPass3.slang b/reshade/shaders/bloom/BloomPass3.slang index 17c4b35..3cfc166 100755 --- a/reshade/shaders/bloom/BloomPass3.slang +++ b/reshade/shaders/bloom/BloomPass3.slang @@ -26,12 +26,13 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 3) uniform sampler2D Original; +layout(set = 0, binding = 4) uniform sampler2D SamplerBloom3; #include "frag_funcs.inc" void main() { - vec4 bloom = GaussBlur22(vTexCoord.xy, Source, 16., 0., false); + vec4 bloom = GaussBlur22(vTexCoord.xy, SamplerBloom3, 16., 0., false); bloom.w *= global.fAnamFlareAmount; bloom.xyz *= global.fBloomAmount; FragColor = bloom; diff --git a/reshade/shaders/bloom/BloomPass4.slang b/reshade/shaders/bloom/BloomPass4.slang index beeaccf..b64e164 100755 --- a/reshade/shaders/bloom/BloomPass4.slang +++ b/reshade/shaders/bloom/BloomPass4.slang @@ -26,13 +26,14 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 3) uniform sampler2D Original; +layout(set = 0, binding = 4) uniform sampler2D SamplerBloom4; #include "frag_funcs.inc" void main() { vec4 bloom = vec4(0.); - bloom.xyz = GaussBlur22(vTexCoord, Source, 16., 0., true).xyz * 2.5; - bloom.w = GaussBlur22(vTexCoord, Source, 32 * global.fAnamFlareWideness, 0., false).w * 2.5; // to have anamflare texture (bloom.w) avoid vertical blur + bloom.xyz = GaussBlur22(vTexCoord, SamplerBloom4, 16., 0., true).xyz * 2.5; + bloom.w = GaussBlur22(vTexCoord, SamplerBloom4, 32 * global.fAnamFlareWideness, 0., false).w * 2.5; // to have anamflare texture (bloom.w) avoid vertical blur FragColor = bloom; } \ No newline at end of file diff --git a/reshade/shaders/bloom/LensFlarePass0.slang b/reshade/shaders/bloom/LensFlarePass0.slang index ae635f8..33b5681 100755 --- a/reshade/shaders/bloom/LensFlarePass0.slang +++ b/reshade/shaders/bloom/LensFlarePass0.slang @@ -34,7 +34,7 @@ void main() vec4 lens = vec4(0.); // Lenz - if (global.bLenzEnable > 0.5) + if (bLenzEnable) { const vec3 lfoffset[19] = { vec3(0.9, 0.01, 4), @@ -92,7 +92,7 @@ void main() lfcoord.xy = 0.5 - lfcoord.xy; vec2 tempfact = (lfcoord.xy - 0.5) * 2.; float templensmult = clamp(1.0 - dot(tempfact, tempfact), 0., 1.); - vec3 lenstemp1 = vec3(dot(textureLod(Original, vec2(lfcoord.xy), 1.0).rgb, vec3(0.333))); + vec3 lenstemp1 = vec3(dot(textureLod(BackBuffer, vec2(lfcoord.xy), 1.0).rgb, vec3(0.333))); /* Doesn't exist in RetroArch, so comment it out #if LENZ_DEPTH_CHECK float templensdepth = texture(ReShade::DepthBuffer, lfcoord.xy).x; @@ -110,17 +110,17 @@ void main() } // Chapman Lens - if (global.bChapFlareEnable > 0.5) + if (bChapFlareEnable) { vec2 sample_vector = (vec2(0.5, 0.5) - vTexCoord.xy) * global.fChapFlareDispersal; vec2 halo_vector = normalize(sample_vector) * global.fChapFlareSize; - vec3 chaplens = GetDistortedTex(Original, vTexCoord.xy + halo_vector, halo_vector, fChapFlareCA * 2.5).rgb; + vec3 chaplens = GetDistortedTex(BackBuffer, vTexCoord.xy + halo_vector, halo_vector, fChapFlareCA * 2.5).rgb; for (int j = 0; j < int(global.iChapFlareCount); ++j) { vec2 foffset = sample_vector * float(j); - chaplens += GetDistortedTex(Original, vTexCoord.xy + foffset, foffset, fChapFlareCA).rgb; + chaplens += GetDistortedTex(BackBuffer, vTexCoord.xy + foffset, foffset, fChapFlareCA).rgb; } chaplens *= 1.0 / global.iChapFlareCount; @@ -128,7 +128,7 @@ void main() } // Godrays - if (global.bGodrayEnable > 0.5) + if (bGodrayEnable) { const vec2 ScreenLightPos = vec2(0.5, 0.5); vec2 texcoord2 = vTexCoord; @@ -140,8 +140,8 @@ void main() for (int g = 0; g < int(global.iGodraySamples); g++) { texcoord2 -= deltaTexCoord;; - vec4 sample2 = textureLod(Original, vec2(texcoord2), 0.); - float sampledepth = textureLod(Original, vec2(texcoord2), 0.).x; + vec4 sample2 = textureLod(BackBuffer, vec2(texcoord2), 0.); +// float sampledepth = textureLod(BackBuffer, vec2(texcoord2), 0.).x; //no depth checking in RA so just comment it out sample2.w = clamp(dot(sample2.xyz, vec3(0.3333)) - global.fGodrayThreshold, 0., 1.); sample2.r *= 1.00; sample2.g *= 0.95; @@ -158,14 +158,14 @@ void main() } // Anamorphic flare - if (global.bAnamFlareEnable > 0.5) + if (bAnamFlareEnable) { vec3 anamFlare = vec3(0.); const float gaussweight[5] = { 0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 }; for (int z = -4; z < 5; z++) { - anamFlare += GetAnamorphicSample(0, vTexCoord.xy + vec2(0, z * (vTexCoord.y * params.SourceSize.w) * 2.), global.fFlareBlur) * fFlareTint * gaussweight[abs(z)]; + anamFlare += GetAnamorphicSample(0, vTexCoord.xy + vec2(0, z * PixelSize.y * 2.), global.fFlareBlur) * fFlareTint * gaussweight[abs(z)]; } lens.xyz += anamFlare * global.fFlareIntensity; diff --git a/reshade/shaders/bloom/LightingCombine.slang b/reshade/shaders/bloom/LightingCombine.slang index 8e9564a..daa2475 100755 --- a/reshade/shaders/bloom/LightingCombine.slang +++ b/reshade/shaders/bloom/LightingCombine.slang @@ -26,8 +26,8 @@ layout(location = 0) in vec2 vTexCoord; layout(location = 0) out vec4 FragColor; layout(set = 0, binding = 2) uniform sampler2D Source; layout(set = 0, binding = 3) uniform sampler2D Original; -layout(set = 0, binding = 4) uniform sampler2D Bloom3; -layout(set = 0, binding = 5) uniform sampler2D Bloom5; +layout(set = 0, binding = 4) uniform sampler2D SamplerBloom3; +layout(set = 0, binding = 5) uniform sampler2D SamplerBloom5; layout(set = 0, binding = 6) uniform sampler2D Dirt; layout(set = 0, binding = 7) uniform sampler2D Sprite; layout(set = 0, binding = 8) uniform sampler2D LensFlare1; @@ -39,12 +39,12 @@ layout(set = 0, binding = 8) uniform sampler2D LensFlare1; void main() { vec4 color = vec4(0.); - color = texture(Original, vTexCoord.xy); + color = texture(BackBuffer, vTexCoord.xy); // Bloom vec3 colorbloom = vec3(0.); - colorbloom += texture(Bloom3, vTexCoord.xy).rgb * 1.0; - colorbloom += texture(Bloom5, vTexCoord.xy).rgb * 9.0; + colorbloom += texture(SamplerBloom3, vTexCoord.xy).rgb * 1.0; + colorbloom += texture(SamplerBloom5, vTexCoord.xy).rgb * 9.0; colorbloom *= 0.1; colorbloom = saturate(colorbloom); float colorbloomgray = dot(colorbloom, vec3(0.333)); @@ -61,17 +61,17 @@ void main() color.rgb = max(color.rgb, colorbloom); // Anamorphic flare - if (global.bAnamFlareEnable > 0.5) + if (bAnamFlareEnable) { - vec3 anamflare = texture(Bloom5, vTexCoord.xy).w * 2. * fAnamFlareColor; + vec3 anamflare = texture(SamplerBloom5, vTexCoord.xy).w * 2. * fAnamFlareColor; anamflare = max(anamflare, 0.0); color.rgb += pow(anamflare, vec3(1.0 / global.fAnamFlareCurve)); } // Lens dirt - if (global.bLensdirtEnable > 0.5) + if (bLensdirtEnable) { - float lensdirtmult = dot(texture(Bloom5, vTexCoord).rgb, vec3(0.333)); + float lensdirtmult = dot(texture(SamplerBloom5, vTexCoord).rgb, vec3(0.333)); vec3 dirttex = texture(Dirt, vTexCoord).rgb; vec3 lensdirt = dirttex * lensdirtmult * global.fLensdirtIntensity; @@ -88,13 +88,13 @@ void main() } // Lens flares - if (global.bAnamFlareEnable > 0.5 || global.bLenzEnable > 0.5 || global.bGodrayEnable > 0.5 || global.bChapFlareEnable > 0.5) + if (bAnamFlareEnable || bLenzEnable || bGodrayEnable || bChapFlareEnable) { vec3 lensflareSample = texture(LensFlare1, vTexCoord.xy).rgb, lensflareMask; - lensflareMask = texture(Sprite, vTexCoord + vec2( 0.5, 0.5) * (vTexCoord.xy * params.SourceSize.zw)).rgb; - lensflareMask += texture(Sprite, vTexCoord + vec2(-0.5, 0.5) * (vTexCoord.xy * params.SourceSize.zw)).rgb; - lensflareMask += texture(Sprite, vTexCoord + vec2( 0.5, -0.5) * (vTexCoord.xy * params.SourceSize.zw)).rgb; - lensflareMask += texture(Sprite, vTexCoord + vec2(-0.5, -0.5) * (vTexCoord.xy * params.SourceSize.zw)).rgb; + lensflareMask = texture(Sprite, vTexCoord + vec2( 0.5, 0.5) * PixelSize).rgb; + lensflareMask += texture(Sprite, vTexCoord + vec2(-0.5, 0.5) * PixelSize).rgb; + lensflareMask += texture(Sprite, vTexCoord + vec2( 0.5, -0.5) * PixelSize).rgb; + lensflareMask += texture(Sprite, vTexCoord + vec2(-0.5, -0.5) * PixelSize).rgb; color.rgb += lensflareMask * 0.25 * lensflareSample; } diff --git a/reshade/shaders/bloom/frag_funcs.inc b/reshade/shaders/bloom/frag_funcs.inc index 39d7ac0..6132709 100644 --- a/reshade/shaders/bloom/frag_funcs.inc +++ b/reshade/shaders/bloom/frag_funcs.inc @@ -1,7 +1,10 @@ +#define PixelSize (params.SourceSize.zw) +#define BackBuffer Original + vec4 GaussBlur22(vec2 coord, sampler2D tex, float mult, float lodlevel, bool isBlurVert) { vec4 sum = vec4(0.); - vec2 axis = isBlurVert ? vec2(0, 1) : vec2(1, 0); + vec2 axis = isBlurVert ? vec2(0., 1.) : vec2(1., 0.); const float weight[11] = { 0.082607, @@ -20,7 +23,7 @@ vec4 GaussBlur22(vec2 coord, sampler2D tex, float mult, float lodlevel, bool isB for (int i = -10; i < 11; i++) { float currweight = weight[abs(i)]; - sum += textureLod(tex, vec2(coord.xy + axis.xy * float(i) * (vTexCoord.xy * params.SourceSize.zw) * mult), lodlevel) * currweight; + sum += textureLod(tex, vec2(coord.xy + axis.xy * float(i) * PixelSize * mult), lodlevel) * currweight; } return sum; @@ -52,7 +55,7 @@ vec3 GetDistortedTex(sampler2D tex, vec2 sample_center, vec2 sample_vector, vec3 vec3 GetBrightPass(vec2 coords) { - vec3 c = texture(Original, coords).rgb; + vec3 c = texture(BackBuffer, coords).rgb; vec3 bC = max(c - global.fFlareLuminance.xxx, 0.0); float bright = dot(bC, vec3(1.0)); bright = smoothstep(0.0f, 0.5, bright); diff --git a/reshade/shaders/bloom/params.inc b/reshade/shaders/bloom/params.inc index 93a4edd..b1801ec 100644 --- a/reshade/shaders/bloom/params.inc +++ b/reshade/shaders/bloom/params.inc @@ -8,14 +8,14 @@ layout(std140, set = 0, binding = 0) uniform UBO float fBloomTint_r; float fBloomTint_g; float fBloomTint_b; - float bLensdirtEnable; + float bLensdirtEnable_toggle; float iLensdirtMixmode; float fLensdirtIntensity; float fLensdirtSaturation; float fLensdirtTint_r; float fLensdirtTint_g; float fLensdirtTint_b; - float bAnamFlareEnable; + float bAnamFlareEnable_toggle; float fAnamFlareThreshold; float fAnamFlareWideness; float fAnamFlareAmount; @@ -23,10 +23,10 @@ layout(std140, set = 0, binding = 0) uniform UBO float fAnamFlareColor_r; float fAnamFlareColor_g; float fAnamFlareColor_b; - float bLenzEnable; + float bLenzEnable_toggle; float fLenzIntensity; float fLenzThreshold; - float bChapFlareEnable; + float bChapFlareEnable_toggle; float fChapFlareThreshold; float iChapFlareCount; float fChapFlareDispersal; @@ -35,7 +35,7 @@ layout(std140, set = 0, binding = 0) uniform UBO float fChapFlareCA_g; float fChapFlareCA_b; float fChapFlareIntensity; - float bGodrayEnable; + float bGodrayEnable_toggle; float fGodrayDecay; float fGodrayExposure; float fGodrayWeight; @@ -50,53 +50,86 @@ layout(std140, set = 0, binding = 0) uniform UBO float fFlareTint_b; } global; +#pragma parameter bLensdirtEnable_toggle "Lens Dirt Enable" 0.0 0.0 1.0 1.0 +#pragma parameter bAnamFlareEnable_toggle "Anam Flare Enable" 0.0 0.0 1.0 1.0 +#pragma parameter bLenzEnable_toggle "Lenz Enable" 0.0 0.0 1.0 1.0 +#pragma parameter bChapFlareEnable_toggle "Chap Flare Enable" 0.0 0.0 1.0 1.0 +#pragma parameter bGodrayEnable_toggle "Godray Enable" 0.0 0.0 1.0 1.0 + #pragma parameter iBloomMixmode "Bloom Mix Mode" 0.0 0.0 2.0 1.0 +//Linear add\0Screen add\0Screen/Lighten/Opacity\0Lighten\0 #pragma parameter fBloomThreshold "Bloom Threshold" 0.8 0.1 1.0 0.1 +//Every pixel brighter than this value triggers bloom. #pragma parameter fBloomAmount "Bloom Amount" 0.8 0.0 20.0 0.1 +//Intensity of bloom. #pragma parameter fBloomSaturation "Bloom Saturation" 0.8 0.0 2.0 0.1 +//Bloom saturation. 0.0 means white bloom, 2.0 means very, very colorful bloom. #pragma parameter fBloomTint_r "Bloom Tint R" 0.7 0.0 1.0 0.05 #pragma parameter fBloomTint_g "Bloom Tint G" 0.8 0.0 1.0 0.05 #pragma parameter fBloomTint_b "Bloom Tint B" 1.0 0.0 1.0 0.05 -#pragma parameter bLensdirtEnable "Lens Dirt Enable" 0.0 0.0 1.0 1.0 +//R, G and B components of bloom tint the bloom color gets shifted to. #pragma parameter iLensdirtMixmode "Lens Dirt Mix Mode" 0.0 0.0 3.0 1.0 +//Linear add\0Screen add\0Screen/Lighten/Opacity\0Lighten\0 #pragma parameter fLensdirtIntensity "Lens Dirt Intensity" 0.4 0.0 2.0 0.1 +//Intensity of lensdirt. #pragma parameter fLensdirtSaturation "Lens Dirt Saturation" 2.0 0.0 2.0 0.1 +//Color saturation of lensdirt. #pragma parameter fLensdirtTint_r "Lens Dirt Tint R" 1.0 0.0 1.0 0.05 #pragma parameter fLensdirtTint_g "Lens Dirt Tint G" 1.0 0.0 1.0 0.05 #pragma parameter fLensdirtTint_b "Lens Dirt Tint B" 1.0 0.0 1.0 0.05 -#pragma parameter bAnamFlareEnable "Anam Flare Enable" 0.0 0.0 1.0 1.0 +//R, G and B components of lensdirt tint the lensdirt color gets shifted to. #pragma parameter fAnamFlareThreshold "Anam Flare Threshold" 0.9 0.1 1.0 0.1 +//Every pixel brighter than this value gets a flare. #pragma parameter fAnamFlareWideness "Anam Flare Width" 2.4 1.0 2.5 0.1 +//Horizontal wideness of flare. Don't set too high, otherwise the single samples are visible. #pragma parameter fAnamFlareAmount "Anam Flare Amt" 14.5 1.0 20.0 0.5 +//Intensity of anamorphic flare. #pragma parameter fAnamFlareCurve "Anam Flare Curve" 1.2 1.0 2.0 0.1 +//Intensity curve of flare with distance from source. #pragma parameter fAnamFlareColor_r "Anam Flare Col R" 0.012 0.0 1.0 0.01 #pragma parameter fAnamFlareColor_g "Anam Flare Col G" 0.313 0.0 1.0 0.01 #pragma parameter fAnamFlareColor_b "Anam Flare Col B" 0.588 0.0 1.0 0.01 -#pragma parameter bLenzEnable "Lenz Enable" 0.0 0.0 1.0 1.0 +//R, G and B components of anamorphic flare. Flare is always same color. #pragma parameter fLenzIntensity "Lenz Intensity" 1.0 0.2 3.0 0.1 +//Power of lens flare effect #pragma parameter fLenzThreshold "Lenz Threshold" 0.8 0.6 1.0 0.1 -#pragma parameter bChapFlareEnable "Chap Flare Enable" 0.0 0.0 1.0 1.0 +//Minimum brightness an object must have to cast lensflare. #pragma parameter fChapFlareThreshold "Chap Flare Threshold" 0.9 0.7 0.99 0.05 +//Brightness threshold for lensflare generation. Everything brighter than this value gets a flare. #pragma parameter iChapFlareCount "Chap Flare Count" 15.0 1.0 20.0 1.0 +//Number of single halos to be generated. If set to 0, only the curved halo around is visible. #pragma parameter fChapFlareDispersal "Chap Flare Dispersal" 0.25 0.25 1.0 0.05 +//Distance from screen center (and from themselves) the flares are generated. #pragma parameter fChapFlareSize "Chap Flare Size" 0.45 0.2 0.8 0.05 +//Distance (from screen center) the halo and flares are generated. #pragma parameter fChapFlareCA_r "Chap Flare CA R" 0.0 0.0 1.0 0.01 #pragma parameter fChapFlareCA_g "Chap Flare CA G" 0.01 0.0 1.0 0.01 #pragma parameter fChapFlareCA_b "Chap Flare CA B" 0.02 0.0 1.0 0.01 +//Offset of RGB components of flares as modifier for Chromatic abberation. Same 3 values means no CA. #pragma parameter fChapFlareIntensity "Chap Flare Intensity" 100.0 5.0 200.0 5.0 -#pragma parameter bGodrayEnable "Godray Enable" 0.0 0.0 1.0 1.0 +//Intensity of flares and halo, remember that higher threshold lowers intensity, you might play with both values to get desired result. #pragma parameter fGodrayDecay "Godray Decay" 0.99 0.5 0.9999 0.05 +//How fast they decay. It's logarithmic, 1.0 means infinite long rays which will cover whole screen #pragma parameter fGodrayExposure "Godray Exposure" 1.0 0.7 1.5 0.05 +//Upscales the godray's brightness #pragma parameter fGodrayWeight "Godray Weight" 1.25 0.8 1.7 0.05 +//weighting #pragma parameter fGodrayDensity "Godray Density" 1.0 0.2 2.0 0.2 +//Density of rays, higher means more and brighter rays #pragma parameter fGodrayThreshold "Godray Threshold" 0.9 0.6 1.0 0.05 +//Minimum brightness an object must have to cast godrays #pragma parameter iGodraySamples "Godray Samples" 128.0 16.0 256.0 16.0 +//2^x format values; How many samples the godrays get #pragma parameter fFlareLuminance "Flare Luminance" 0.095 0.0 1.0 0.005 +//bright pass luminance value #pragma parameter fFlareBlur "Flare Blur" 200.0 1.0 10000.0 50.0 +//manages the size of the flare #pragma parameter fFlareIntensity "Flare Intensity" 2.07 0.2 5.0 0.1 +//effect intensity #pragma parameter fFlareTint_r "Flare Tint R" 0.137 0.0 1.0 0.05 #pragma parameter fFlareTint_g "Flare Tint G" 0.216 0.0 1.0 0.05 #pragma parameter fFlareTint_b "Flare Tint B" 1.0 0.0 1.0 0.05 +//effect tint RGB vec3 fFlareTint = vec3(global.fFlareTint_r, global.fFlareTint_g, global.fFlareTint_b); vec3 fAnamFlareColor = vec3(global.fAnamFlareColor_r, global.fAnamFlareColor_g, global.fAnamFlareColor_b); @@ -104,6 +137,12 @@ vec3 fLensdirtTint = vec3(global.fLensdirtTint_r, global.fLensdirtTint_g, global vec3 fBloomTint = vec3(global.fBloomTint_r, global.fBloomTint_g, global.fBloomTint_b); vec3 fChapFlareCA = vec3(global.fChapFlareCA_r, global.fChapFlareCA_g, global.fChapFlareCA_b); +bool bGodrayEnable = bool(global.bGodrayEnable_toggle); +bool bChapFlareEnable = bool(global.bChapFlareEnable_toggle); +bool bLenzEnable = bool(global.bLenzEnable_toggle); +bool bAnamFlareEnable = bool(global.bAnamFlareEnable_toggle); +bool bLensdirtEnable = bool(global.bLensdirtEnable_toggle); + // If 1, only pixels with depth = 1 get lens flares // This prevents white objects from getting lens flares sources, which would normally happen in LDR #ifndef LENZ_DEPTH_CHECK