For Forgotten By Time, an indie horror game currently in production, I wanted to add an effect which makes objects look unnatural. I needed it to be subtle so as to not distract too much, but is something that makes the object stand out and is creepy if you stop to look at it, as an extra bonus for those who are looking closely. For this effect, I’m going to be adding Fresnel in Unreal within the material and then use a sine wave to change how it glows slightly to give an effect almost as if it’s breathing.
Fresnel in Unreal
Fresnel is an effect which essentially adds an effect around the edges of an object, it does this by working out the normal on the vertex or the pixel of the model and the direction the camera is facing and working out the difference between them. In this case, if you are looking directly at a part of the model it will not have any effect, but as the model bends away from you it starts to have the glowing effect. This also picks up some of the smaller detail on the model even in the dark.
Unreal has a built-in effect to produce this effect with the fresnel material expression. which just needs to be plugged into an existing material to work. Here you can see the fresnel effect on this model in the material set-up.
The Fresnel node does all the work for you. The ExponentIn number affects the sharpness of the effect and the angle at which it starts. Then I multiply it by the colour that I wanted, in this case, purple. This is then multiplied by the breathing effect (which we will cover in a moment) and then it goes into both the base color and the emissive color to add the glow. The color is also multiplied by the texture of the object.
Here the object is again with the emissive turned up significantly so you can see the effect.
To add a breathing effect we’re going to use a sine wave to generate a steady rising and lowering number which we will multiply by the fresnel effect so that it becomes stronger and weaker over time at an even pace.
We use a time node, to have the effect change based on the time since the game started. This is multiplied by a number to change the speed of the effect and plugged into the Sine node which gives us our sine wave. I’ve added and divided this number to get the specific effect that I wanted.
Here is the final effect.