DepthTextureMode.Depth on Mac -> streched Image

System Spec:

  • OS X El Capitan (10.11)
  • Unity 5.3.2f1

Problem:

I’ve got a Problem using
Camera.main.depthTextureMode = DepthTextureMode.Depth;

My Project is more complex but I’ve isolated to this Problem:

In Editor when running and having thes Scene View open or resizing the game view sometimes it gives me this output:
Picture is stetched from a certain point.

Anybody else got this Problem? How to solve it?

On MacOS Expport it always gives me this result (Same scene as in Editor)

I’ve attached this script to my Camera

using UnityEngine;
using System.Collections;

public class ShaderTest : MonoBehaviour {

	public DepthTextureMode depthTextureMode = DepthTextureMode.Depth;
	private DepthTextureMode m_before = DepthTextureMode.None;
	public Vector2 oldSize;

	void Start () {
		oldSize = new Vector2 (Screen.width, Screen.height);
		Debug.Log ("Screen res:" + Screen.width + "x" + Screen.height);	
	}
	
	void Update () {
		Vector2 newSize = new Vector2 (Screen.width, Screen.height);
		if (newSize != oldSize) {
			Debug.Log ("Screen res:" + Screen.width + "x" + Screen.height);	
			oldSize = newSize;
		}

		if (depthTextureMode != m_before) {
			// this causes Problems when setting to Depth
			Camera.main.depthTextureMode = depthTextureMode;
			m_before = depthTextureMode;
		}
	}

	void OnRenderImage (RenderTexture source, RenderTexture destination){
		Graphics.Blit(source,destination);
	}
}

oh, i got this too using the standard Assets…