Object alpha blending

I want to fade trees out when close to the camera, but the transparency shaders have problems with sorting and don’t cash shadows. I don’t want to display the faces “that are only visible because of transparency”.

Is there a way (preferably higher level than shader) that allows to “hide” the object using an alpha value instead of making it transparent?

To illustrate - a normal tree with bumped diffuse shader (obviously no sorting problems):

alt text

The same tree with shader changed to Transparent/Bumped Diffuse. Alpha set to 1, but there are some weird sorting issues. It is important, because I would like to make the transparency gradual, but change of shaders is really noticable and weird.
alt text

This is how I would imagine it - it is the exact same as normal Bumped Diffuse shader, but in the end the object is simply “overlaid” with some alpha value, so that the background is visible. The shadows and all should remain as if the object was 100% opaque.
alt text

I guess the problems would arise when there are several trees overlapping, but is this at all possible?

I suggest you look into Occlusion if you have Unity Pro. If you don’t, I think it may be better to do via script. Have a script attached to the tree that checks the distance to the player. If the distance is lover than,whatever you need, then turn on the renderer.
Example JS:

var VisualDistance = 10.0; //the distance where the tree is no longer visible
private var Player : GameObject;

function Start ()
	{
	Player = GameObject.FindGameObjectWithTag("Player");
	}

function Update ()
	{
	if (Vector3.Distance(Player.transform.position, gameObject.transform.position) < VisualDistance && !gameObject.renderer.enabled)
		{
		gameObject.renderer.enabled = true;
		}
	else if (Vector3.Distance(Player.transform.position, gameObject.transform.position) > VisualDistance && gameObject.renderer.enabled)
		{
		gameObject.renderer.enabled = false;
		}
	}

The reason to do the conditions like that, is so that the renderer.enabled only changes once when the distance threshold is passed in either direction, and not every frame. If your trees have colliders, make sure you also enable/disable them too.