Inside the shader you divide SceneDepth on some float.
This float basically controls the draw distance of the CelShading. You can convert it into variable and tweak to increase draw distance (making it 10 times larger seems to work fine for me).
Also you can fully bypass SkyMask section if you need it to work for everything in the scene.