// Use this for initialization
void Awake()
{
GameObject go = new GameObject("depthCamera");
depthCamera = go.AddComponent<Camera>();
depthCamera.transform.position = Vector3.zero;
depthCamera.transform.rotation = transform.rotation;
depthCamera.transform.localPosition += transform.forward * Near;
depthCamera.transform.parent = transform;
depthCamera.isOrthoGraphic = true;
depthCamera.clearFlags = CameraClearFlags.SolidColor;
depthCamera.backgroundColor = Color.white;
depthTexture = new RenderTexture(TextureSize,TextureSize, 16, RenderTextureFormat.ARGB32);
depthTexture.filterMode = FilterMode.Point;
depthCamera.targetTexture = depthTexture;
depthCamera.SetReplacementShader(shader, null);
depthCamera.enabled = false;
biasMatrix = Matrix4x4.identity;
biasMatrix[ 0, 0 ] = 0.5f;
biasMatrix[ 1, 1 ] = 0.5f;
biasMatrix[ 2, 2 ] = 0.5f;
biasMatrix[ 0, 3 ] = 0.5f;
biasMatrix[ 1, 3 ] = 0.5f;
biasMatrix[ 2, 3 ] = 0.5f;
}