Unreal Engine - Cheap refraction (Post Process only)?



Hello !
I’m trying to do refraction on particles in Unreal (swirling effect and such) but all I see is hacking the refraction in material. Its not really clean and do a lots of unnecessary calculation like depth testing. Is there a way to do distortion effect in post process only ?

Like using scene texture and such.

Thanks :slight_smile:


Well, It depends what you want really, but writing to a custom depth buffer and then sampling using an offset on the post process input does the trick most of the time.

This is probably the most straigtforward way to get control over your refraction, and it is relatively speaking quite cheap because you are only writing to a texture, reading from a texture and subtracting a large number, all of which are quite optimised on GPU.

Alternatively you could also give it a silly colour like magenta and then test if the pixel colour is the exact colour you are looking for. This would omit use of the custom depth buffer, but would increase calculations per pixel on your post processing material.


Why do you want to use post processing though. Refractions per pixel per material are probably cheaper then any post processing solution you could use. Post processing effects are always there, they always cost you frames. Even if you don’t have an effect on screen that uses it.