A simple post-processing effect for the Unity game engine which renders small-scale distortions.
Switch branches/tags
Nothing to show
Clone or download
andrewgotow Correction for angled cameras
Originally, the distortion normal map was stored purely in
screen-space. This caused issues when the camera was at angles relative
to particles, as the relative orientation of the UV offset would change
due to camera rotation.

Now, the UVs are calculated in world-space, and the camera transforms
the distortion map back into camera space before applying the offset.
Latest commit 53466a1 Jan 24, 2018
Permalink
Failed to load latest commit information.
screenshots Added Demo Scene 2, screenshots Nov 10, 2015
unity project Correction for angled cameras Jan 23, 2018
README.md Added animated GIF to readme Nov 10, 2015

README.md

Heatwave

Heatwave is a simple post-processing effect for the Unity game engine, designed to add small-scale distortion and refraction effects to your scenes. Using a two-camera system, distortions can be caused by particle effects, fullscreen overlays, GUI elements, and whatever else you might want! Heatwave is designed to be simple and efficient, sacrificing accuracy for incredible performance, and ease of use. Setup is automatic, and configuring your effects takes only a few minutes.

How it works.

Heatwave is based loosely on a presentation given at Unite 2007, and builds a fullscreen normal map based on specific rendered layers in the scene. This normal map is then used to calculate light refractions, as though the entire scene were being viewed through a thick pane of glass. This means that the cost of computation is fixed, and additional refraction source will not significantly impact performance. It also allows the normal buffer to be written by mulitple different sources, meaning you can combine multiple different sources to produce interesting outputs. The downside of this solution is that the effect is not actually calculating refractions. Complex lensing effects are not feasible, and interesting optical phenomena such as refracting light onto otherwise occluded surfaces simply will not work. This effect is designed only to "look right", rather than simulate optics.

How to use it.

Heatwave is incredibly easy to use. Create a scene, and attach the Heatwave image effect script to your camera. With this script attached, any particle effects using the "Distortion Source" shader will be rendered into the normal buffer. Other objects can work, though particles tend to work best. These objects should be colored like a traditional normal map, and are alpha blended into the buffer. That's all there is to it!