What is it
Effect : Refraction effect
Author : H�ctor Barreiro Cabrera
Minium Pixel Shader : 2.0
Description
This effect refracts the objects underneath it through the use of a normalmap texture. This effect is useful for distortioning images to make effects like glass or water refraction. The key difference with the distort effect is that this one the distortion over each axis is controllable through the normal's color channels.
The channels assigned to each axis are the following:
- Red : X
[ul]
[li]Green : Y[/li]
[li]Blue : Z (unused)[/code:3pvs1iil][/li]
[/ul]
From there, the color applied on the normal map will determine the amount to displace. 127 (0.5) means no distortion, 255 means the pixel will be displaced to the right, and 0 means the pixel will be displaced to the left.
The amount of displacement is also configurable through the parameter in the effect's properties. It will tell the shader how much the pixel will be displaced when doing a full displacement, and it will be interpolated accordingly.
For a more info on how the normal maps work, refer to the example and/or google for "Normal mapping".
[h2][b]Download[/b][/h2]
[url=http://www.aethermachine.com/construct/shaders/Refraction.fx]Download the effect.[/url]
[url=http://www.aethermachine.com/construct/shaders/Refraction.cap]Download the example (Made with Construct 99.4 beta).[/url]
Disclaimer: The example images contained within the example file were not made by me, but downloaded through a Google search. I claim no rights about the images, they belong to their authors.
[h2][b]Screenshots[/b][/h2]
<img src="http://www.aethermachine.com/construct/shaders/Refraction_1.jpg">
<img src="http://www.aethermachine.com/construct/shaders/Refraction_2.jpg">