I am trying to use UE's LensDistortion plugin (seems like it's bundled with the engine but only put to use in the Compositing sample project), and following the same workflow as the sample. Essentially, the idea is to create a camera model using the standard distortion parameters (radial, tangential etc.). The plugin then 'draws' a UV displacement map according to these params, and the original image is then distorted by adding these displacements to the corresponding pixels.
The level blueprint creates the displacement map and a material uses this to distort a given image (the distortion values are written only on the R and G channels, hence the mask in the material). Both are shown in these images:
I don't understand the output I am getting. Seems to me the material function somehow ends up addressing invalid pixel values (less than 0 or greater than 1, assuming UV range is 0-1), so I see a strange 'repeating' of the image, as below:
The way the whole canvas is distorted makes sense spatially: but the pixel values corresponding to those locations are wrong. Am I doing something wrong in my material? How do I properly use this distortion plugin?