BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.23k stars 4.61k forks source link

Implementation of new filter Caustic Refraction #2443

Open mobihunterz opened 7 years ago

mobihunterz commented 7 years ago

Want to implement Caustic Refraction filter from https://github.com/FlexMonkey/Filterpedia/blob/master/Filterpedia/customFilters/CausticRefraction.swift. I am able to write GLSL code and able to generate caustic noise image as well.

Caustic Noise Image

But when I write caustic refraction GLSL code, I get wrong output.

Output Image

The main thing in the code I am not able to understand is vec3 outputPixel = sample(image, samplerTransform(image, d + refractVector.xy)).rgb;

Will you able to help me understand this line? As my output highly differs from the expectation and because I have converted the whole Kernel code into GLSL code and this line into highp vec3 outputPixel = texture2D(inputImageTexture, uv+refractVector.xy).rgb;

Your help is appreciated. Thanks.