Make Outline material fade/hide with distance

Figured it out.

Duplicate your outline script. Add a new Lerp node and plug it into emissive. Plug The original outline script into Lerp A. Plug the duplicate outline into Lerp B. Add the script in the image to the Alpha. Mess with the Divide and Power constant to determine the best fade from first person camera for your situation. Mine is 250000 Divide, .5 Power. On the Duplicate script (plugged into B) in my case, I just turned the parameters to 0 (line width, bloom, etc.) which effectively shuts the outline off, so it fades from the original outline to no outline in the distance. If you want to, you can compound this script and have it fade in layers, for example, near outlines could be blue, then they fade to yellow in the distance and then fade out completely far away. This fade script is similar to how I fade ground textures out in the distance.

2 Likes