Fisheye postprocess mat for 160 deg FOV (presentable but not "done")

So, after looking for a while and only finding something that didn’t do the shape I wanted (the one I found did the distortion separately on vertical and horizontal axis, instead of radially), I figured out enough of the material system to do my own version from scratch.

I only half-know what I’m doing though (maybe even less than half), but I think it might be good enough to be shared. Maybe someone will work out the bugs, or perhaps make sense of the stuff I stumbled upon by trial and error instead of actually deducing.

It works well for FOVs or around 160 degrees (much more and there aren’t enough pixels to do anything with, and lower it gets distorted incorrectly and I haven’t quite figured out what I need to change to correct the distortion to correspond to the smaller fovs. For some reason I haven’t figured out yet, it can get wonky if the game window isn’t maximized/fullscreen’d, and it breaks similarly with less than full resolution. I’ve only tested it in a 1920x1080 screen, not sure if it works at other resolutions and aspect ratios). I think there are a couple more remarks in the comments inside the material.

Without fisheye (FOV 160 degrees):

With fisheye (FOV 160 degrees):


(I probably should’ve set the width (aspect ratio param) to about half of what I did in this screenie)

Notice how stuff on the edges of the field of view look more natural (discounting the issue with the aspect ratio), and stuff on the center doesn’t seem to be so far away.

Ah, for anything in the attached file (TT_Fisheye.zip) that isn’t licensed by someone else, I’m putting it in the public domain, do whatever you want with it. (was this necessary?)

edit: woah, the screenshots look huge in the post; should I make smaller versions of the pictures?

sorry,i didnt find the attached file (tt_fisheye.zip),where can i find it , your tutor is really helpful to me, can you send me the url, thanks a lot