Rick Posted December 18, 2013 Share Posted December 18, 2013 Anyone able to point me in a direction on how to blur just a portion of the top and bottom of the screen via a shader to give this effect http://tiltshiftmaker.com/ ? Quote Link to comment Share on other sites More sharing options...
nate066 Posted December 19, 2013 Share Posted December 19, 2013 precision mediump float; uniform sampler2D vTex; varying vec2 vCoord; const float step_w = 0.0015625; const float step_h = 0.0027778; vec3 blur() { float y = vCoord.t < 0.4 ? vCoord.t : 1.0 - vCoord.t; float dist = 8.0 - 20.0 * y; vec3 acc = vec3(0.0, 0.0, 0.0); for (float y=-2.0; y<=2.0; ++y) { for (float x=-2.0; x<=2.0; ++x) { acc += texture2D(vTex, vec2(vCoord.x + dist * x * step_w, vCoord.y + 0.5 * dist * y * step_h)).bgr; } } return acc / 25.0; } void main(void) { vec3 col; if (vCoord.t >= 0.4 && vCoord.t <= 0.6) col = texture2D(vTex, vCoord).bgr; else col = blur(); gl_FragColor.a = 1.0; gl_FragColor.rgb = col; } The code above is faking tilt shift its from this website: http://kodemongki.blogspot.com/2011/06/kameraku-custom-shader-effects-example.html and this topic should help also. http://stackoverflow.com/questions/4579020/how-do-i-use-a-glsl-shader-to-apply-a-radial-blur-to-an-entire-scene 1 Quote Link to comment Share on other sites More sharing options...
shadmar Posted December 19, 2013 Share Posted December 19, 2013 You have to wait for postprocessing support in Leadwerks 3. 1 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.