2

I am using GPUImage for adding filters on UIImage. GPUImage does not contain fish eye distortion effect, I need shader code for fish eye distortion effect which could be used in GPUImage custom filter.

Cœur
  • 32,421
  • 21
  • 173
  • 232
Waqar Ali
  • 31
  • 6
  • did you manage to complete this one? any starting point? – Muhammad Faizan Khatri Aug 29 '17 at 11:46
  • NSString *const kGPUImageFishEyeFragmentShaderString=SHADER_STRING (varying highp vec2 textureCoordinate; uniform sampler2D inputImageTexture; const mediump float bulgeFactor = 0.5; void main() { mediump vec2 processedTextureCoordinate = textureCoordinate - vec2(0.5); mediump float radius = processedTextureCoordinate.x*processedTextureCoordinate.x + processedTextureCoordinate.y*processedTextureCoordinate.y; mediump vec2 distortedCoordinate = vec2(pow(radius, bulgeFactor))*processedTextureCoordinate + vec2(0.5); gl_FragColor = texture2D(inputImageTexture, distortedCoordinate); }); Try this – Waqar Ali Sep 05 '17 at 10:36

0 Answers0