Here is a video about unity depth shader workarounds:
also his tutorial 6.2 and 6.3 are all about depth...
and this unity resource: http://unity3d.com/support/documentation/Components/SL-CullAndDepth.html
Here is a Ton of info about it with 3 solutions:
http://software.intel.com/en-us/articles/alternatives-to-using-z-bias-to-fix-z-fighting-issues/
I have ended with a custom-non-optimal-solution that at least works for me. I add a"ZFighter" component to any GameObject which I want to get a little bit distanced from a back object/wall. This separation is calculated according to Camera distance.
using UnityEngine;
using System.Collections;
public class ZFighter : MonoBehaviour {
// Use this for initialization
private Vector3 lastLocalPosition;
private Vector3 lastCamPos;
private Vector3 lastPos;
void Start () {
lastLocalPosition = transform.localPosition;
lastPos = transform.position;
lastCamPos = Camera.main.transform.position - Vector3.up; // just to force update on first frame
}
void Update () {
Vector3 camPos = Camera.main.transform.position;
if (camPos != lastCamPos || transform.position != lastPos) {
lastCamPos = camPos;
transform.localPosition = lastLocalPosition + (camPos - transform.position) * 0.01f;
lastPos = transform.position;
}
}
}