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)
Related Posts
Leave a comment
Recent posts
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)