UE4 Shader Refraction Formula


I’ve been trying to replicate (with nodes) the refraction that UE4 generates on a shader. Ignoring the fresnel and all that… If I just add a IOR of 1.5 to refraction (for example), it distorts the image you see through it.

I am hoping to create that exact distortion to the output of SceneColor.

I went through the shader files and I believe I found what is going on in DistortAccumulatePs.usf and DistortApplyScreenPS.usf - But my knowledge of the source code is a little limited and can’t understand it fully.

I was wondering if anyone could point me in the right direction.



I was going way too off-topic and I don’t want to make this my personal blog of thoughts…

Making sense of the source code little by little and figuring things out veeeery slowly.

I am still trying to re-create the distortion so any help would be appreciated.