* Additive lighting * adds options for all your optional needs * one last tiny adjustment before we hit the create pr button * spaghetti condensing * add ccvar * overlight correction * fix requested changes * cvar fix * last fix * nice --------- Co-authored-by: deathride58 <deathride58@users.noreply.github.com> Co-authored-by: MetalSage <metalsage.official@gmail.com> Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> Co-authored-by: Ed <edwardxperia2000@gmail.com>
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
//Boilerplate
|
|
uniform sampler2D SCREEN_TEXTURE;
|
|
uniform sampler2D LIGHT_TEXTURE;
|
|
|
|
uniform highp float Zoom;
|
|
|
|
//Variables for controlling the falloff of the additive lighting effect.
|
|
uniform highp float CircleRadius; //= 420.0;
|
|
uniform highp float CircleMinDist; //= 0.0;
|
|
uniform highp float CirclePow; //= 1.0;
|
|
uniform highp float CircleMax; //= 4.0;
|
|
uniform highp float CircleMult; //= 0.25;
|
|
uniform highp float FalloffClampMin; //= 0.075;
|
|
uniform highp float FalloffClampMax; //= 1.0;
|
|
uniform highp float FalloffStrength; //= 0.75;
|
|
uniform highp float FalloffPow; //= 3.0;
|
|
uniform highp float HDR; //= 1.5;
|
|
|
|
void fragment() {
|
|
COLOR = zTextureSpec(SCREEN_TEXTURE, Pos);
|
|
highp vec2 aspect = vec2(1.0/SCREEN_PIXEL_SIZE.x, 1.0/SCREEN_PIXEL_SIZE.y);
|
|
highp float actualZoom = Zoom;
|
|
|
|
highp float circle = clamp(zCircleGradient(aspect, FRAGCOORD.xy, CircleMax, CircleRadius / actualZoom, CircleMinDist / actualZoom, CirclePow) * CircleMult, FalloffClampMin, FalloffClampMax);
|
|
|
|
highp vec3 lightsampleraw = texture2D(LIGHT_TEXTURE, Pos).rgb;
|
|
lightsampleraw = smoothstep(0.0, HDR, lightsampleraw);
|
|
highp float graylight = max(zGrayscale(lightsampleraw) - max((1.0 - circle) * FalloffStrength, 0.0), 0.0);
|
|
graylight = pow(graylight, FalloffPow);
|
|
|
|
highp vec3 lightsample = lightsampleraw * vec3(graylight);
|
|
|
|
COLOR.rgb = COLOR.rgb + lightsample;
|
|
} |