Sep
21
2019

Modified Standard shader to start fading based on Camera Y distance

Needed this kind of effect for a small game, where:
– objects below would be faded out
– player can move up and down (fade should “follow”)
– realtime lights should be supported

basically like the old unity global fog for height, but that one doesn’t work with newer unitys.. and shadergraph might have helped to create this effect, but i’m not using new render pipelines..

Source:
https://github.com/UnityCommunity/UnityLibrary/blob/master/Assets/Shaders/3D/Effects/VerticalCameraDistanceFade.shader

Without custom lighting in shader, it didn’t work, even with black ambient color, since there are lights in the scene (image below)


Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch Instagram

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.