Combining Fresnel with Distortion shader

Hy there.
I am making a explosion shockwave. Since a shockwave is nothing more than compressed air bending the light, a distortion shader would be perfect for this effect. I discovered the Dvornik-Distortion shader which is very good, but is uses a texture map as the distortion input. So I got the idea to combine a Fresnel calculation, generate a B&W texture and feed it into the distortion texture input.
But the problem is: I have no funcking clue how to write shaders…
So I was wondering if someone could help me out on this one :slight_smile:

Well Maybe a picture could help out explain what the problem is:

A texturemap would only work from a specific point of view. But a fresnel would always give the desired result.

Link to the distortion shader

For anyone coming to this post in the future, you may be looking for the Spherize node. This is the result of a quick distortion shader setup:
185126-image-2021-08-20-204345.png


The Spherize node warps the UV into a spherical shape. If you invert the scale, you can invert the effect. Here’s my node setup:
185125-image-2021-08-20-204155.png


This Spherize node has a strength value of 500 which is set by plugging a Float input node into the strength input of the Spherize node. Set the strength to whatever works for you; my project requires the object to be very close to the camera.

Next, plug the UV output of the Spherize node into a Tiling And Offset node, then set the Tiling to -1 using another Float input node. This inverts the bulge and scales it, too.


Remember to turn on “Distortion” in your Graph Inspector window in the node editor! Enable “Distortion Only.”