public
Last active

radial blur, based on bkcore.com code

  • Download Gist
gistfile1.c
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// radial blur from touch pos, from http://bkcore.com/blog/3d/webgl-three-js-volumetric-light-godrays.html
 
vec3 draw() {
vec2 vUv = p;
float fX=t1.x, fY=t1.y, illuminationDecay = 1.0,
fExposure = 0.2, fDecay = 0.93,
fDensity = .3, fWeight = 0.4, fClamp = 1.0;
const int iSamples = 8;
vec2 delta = vec2(vUv-vec2(fX,fY))/float(iSamples)*fDensity, coord = vUv;
vec4 FragColor = vec4(0.0);
for(int i=0; i < iSamples ; i++) {
coord -= delta;
vec4 texel = vec4( cam(coord), 0.0);
texel *= illuminationDecay * fWeight;
FragColor += texel;
illuminationDecay *= fDecay;
}
FragColor *= fExposure;
FragColor = clamp(FragColor, 0.0, fClamp);
return(vec3(FragColor));
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.