WtymonrW Posted April 16, 2015 Share Posted April 16, 2015 Did anyone know, how to create effects like in ?Code sample, if possible Quote Link to comment Share on other sites More sharing options...
gamecreator Posted April 16, 2015 Share Posted April 16, 2015 It looks like a raindrop effect I've seen where the camera gets blurred/distorted in areas as drops hit it. Our shader pros could have this done in their sleep, I'm sure. Quote Link to comment Share on other sites More sharing options...
shadmar Posted April 16, 2015 Share Posted April 16, 2015 Here is a classic fisheye shader, you cn play with the zoom value and aperture values #version 400 uniform sampler2D texture1; uniform bool isbackbuffer; uniform vec2 buffersize; uniform float currenttime; out vec4 fragData0; const float PI = 3.1415926535; void main(void) { float zoom=2.0; float aperture = 178.0; float apertureHalf = 0.5 * aperture * (PI / 180.0); float maxFactor = sin(apertureHalf); vec2 tcoord = vec2(gl_FragCoord.xy/buffersize); if (isbackbuffer) tcoord.y = 1.0 - tcoord.y; vec2 uv; vec2 xy = zoom * tcoord.xy - zoom*.5; float d = length(xy); if (d < (2.0-maxFactor)) { d = length(xy * maxFactor); float z = sqrt(1.0 - d * d); float r = atan(d, z) / PI; float phi = atan(xy.y, xy.x); uv.x = r * cos(phi) + 0.5; uv.y = r * sin(phi) + 0.5; } else { uv = tcoord.xy; } vec4 c = texture(texture1, uv); fragData0 = c; } 5 Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
WtymonrW Posted April 16, 2015 Author Share Posted April 16, 2015 Here is a classic fisheye shader Thanks! That's all I needed Quote 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.