A Hat In Time Camera Dithering/Object Fade Unreal Engine 4 Tutorial

I struggled with trying to recreate fading objects when the camera approaches them for a good 4 hours, so I figured I’m probably not the only one.

This is actually incredibly easy to create. If you’re an experienced user you should be able to get the gist from the screenshot. I’m going to add an extended explanation for anyone that might need it.

Right click on the empty space in your content browser and create a new Material.

Double click to open the Material and the first thing you’ll want to do is click the Material Inputs node (The giant node with all the inputs) to show options in the the Details panel.

Under Material in the Details panel, set the Blend Mode to Masked. This will expose the Opacity Mask input.

Right click the empty space and add the World Position and Camera Position nodes, then add a SphereMask and plug them together as shown in the screenshot.

The radius and hardness nodes you see are called Scalar Parameters. You can hold the “S” key and click on empty space to create these nodes. Be sure to name them in the Details panel.

Connect the Scalar Parameters up to the sphere mask.

Add in DitherTemporalAA, and a node called OneMinus (x-1 in the screenshot) and connect them up. The OneMinus node essentially flips how the opacity mask is handled that we’re creating. Alternatively if you wanted to, you could show objects based on how close the camera is to them by removing the x-1 node.

Last thing to do is to connect the x-1 node up to Opacity Mask and hit Apply and Save.

Apply the material to an object and play with the Radius and Hardness values until you get the desired effect.

If you have any questions or feedback, let me know.

Hope that helps!

Happy Hunting,
-Metric

So you have to add this node setup to every single material in the game, for every object that it makes sense to be able to fade out?

If that bothers you, then you seriously need to learn how to work with Master Materials.

For my Game Jam entry we used a low poly style with a single texture that held all the colors the game needed. It was very easy to incorporate it in that situation. It was a top down game where walls could get between the player and the camera. But unfortunately yes, for each unique material that needs to have camera dithering you would need to apply that set of nodes. However, you can basically just copy/paste it once you set it up the first time. Takes only a few seconds, but it’s worth it in my opinion.