radial blur, based on bkcore.com code
// 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)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment