swwmgz_m/shaders/glsl/Grain.fp
Marisa Kirisame aabc9de051 0.9.10b release (oh boy where do I start):
- New fun options implemented (omnibusting, unlimited fuel, party time)
 - Biospark Carbine gets a requested nerf
 - Candygun combo fire has been buffed (watch out for that splash damage)
 - All powerup effects are additive (stacc 'em)
 - Automap hud respects gzdoom's cvars for toggling certain elements
 - Automap hud shows stats and times in gold when 100% / under par
 - Weapons and ammo are no longer affected by skill amount modifiers, for balance (and to avoid any weird glitches)
 - Sorting improvements for menu (weapons by slot, ammo by weapons, other items by value, etc.)
 - Grilled Cheese Sandwich now saves you from lethal falls properly
 - Blown kisses instakill nazis
 - Added non-violent Keen replacement (based on "Less mean-spirited Keen replacement" by SiFi270)
 - Added gib deaths for hell nobles, pinkies, cacos, revs and viles (sprites by Amuscaria and Ryan Cordell)
 - Blown kisses can activate use switches
 - Gestures can be chained by pressing a gesture button while another is playing
 - Fixed Grilled Cheese Sandwich not avoiding telefrags properly (now also works with voodoo dolls)
 - More precise weapon kill tracking (fixes some ragekit quirks)
 - Merge both DLC weaponsets, removing redundant weapons (see FuturePlans.md)
 - Discarded some collectables for the next updates, to save time
 - Preparation work for collectables update, including some (partial) lore files
 - Remove ammo fabricators from store, makes no sense to have them when you can just buy ammo directly
 - Cosmetic Boss Brain sprite replacements, just for fun
 - 10 more intermission tips, because yes
 - Added option to reduce distance at which enemy healthbars are picked
 - Various minor bugfixes and adjustments (and also some tiny typo fixes)
 - Ragekit now heals over time and with each hit (so it's more rewarding to go wild)
 - PNG optimization pass (again lol)
 - Fix crouched gestures having no facial animation
2020-10-05 23:29:28 +02:00

59 lines
1.6 KiB
GLSL

/*
Complex grain shader ported over from MariENB
(C)2012-2018 Marisa Kirisame
*/
const float nf = .000005;
const vec3 nm1 = vec3(2.05,3.11,2.22);
const float nk = .04;
const vec3 nm2 = vec3(4.25,9.42,6.29);
const float ns = -.08;
const float np = 3.95;
const float bnp = 1.7;
#define darkmask(a,b) (a>.5)?(2.*a*(.5+b)):(1.-2.*(1.-a)*(1.-((.5+b))))
vec3 grain( in vec3 res, in vec2 coord )
{
float ts = Timer*nf;
vec2 s1 = coord+vec2(0.,ts);
vec2 s2 = coord+vec2(ts,0.);
vec2 s3 = coord+vec2(ts,ts);
float n1, n2, n3;
vec2 nr = textureSize(NoiseTexture,0);
s1 = mod(s1*nm1.x*nr,1.);
s2 = mod(s2*nm1.y*nr,1.);
s3 = mod(s3*nm1.z*nr,1.);
n1 = texture(NoiseTexture,s1).r;
n2 = texture(NoiseTexture,s2).g;
n3 = texture(NoiseTexture,s3).b;
s1 = coord+vec2(ts+n1*nk,n2*nk);
s2 = coord+vec2(n2,ts+n3*nk);
s3 = coord+vec2(ts+n3*nk,ts+n1*nk);
s1 = mod(s1*nm2.x*nr,1.);
s2 = mod(s2*nm2.y*nr,1.);
s3 = mod(s3*nm2.z*nr,1.);
n1 = texture(NoiseTexture,s1).r;
n2 = texture(NoiseTexture,s2).g;
n3 = texture(NoiseTexture,s3).b;
float n4 = (n1+n2+n3)/3.0;
vec3 ng = vec3(n4);
vec3 nc = vec3(n1,n2,n3);
vec3 nt = pow(clamp(mix(ng,nc,ns),0.,1.),vec3(np));
float bn = 1.-clamp((res.r+res.g+res.b)/3.,0.,1.);
bn = pow(bn,bnp);
vec3 nn = clamp(nt*bn,vec3(0.),vec3(1.));
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;
}
void main()
{
vec2 coord = TexCoord;
vec4 res = texture(InputTexture,coord);
vec2 sfact = max(vec2(640.,400.),textureSize(InputTexture,0)*.5);
coord = floor(coord*sfact)/sfact;
res.rgb = grain(res.rgb,coord);
FragColor = res;
}