Unity SkyBox Solution
I had the same problem many people where having here, using the Example Oculus Sky box solution and having it clip large terrain at a distance.
The solution is to use use a shader that is set to "Queue"="Background" and ZWrite off for the sky box materials.
Here is the shader I modified:
I use it by dragging the /Assets/Tuscany/Models/Prefabs/Skybox.prefab in to my scene, I replaced each material to use the above shader
I also created a script that makes the skybox copy my OVRCamera position but not its rotation:
So this way you can make the sky box small, encompassing both cameras and it will draw first before the entire scene without updating the zbuffer. Also i set both cameras Clear Flags property to Depth Only, since the background will clear the color buffer, you save a little bit of render time.
The solution is to use use a shader that is set to "Queue"="Background" and ZWrite off for the sky box materials.
Here is the shader I modified:
Shader "Unlit/Vertex Color Multiply Background" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
}
Category {
Tags { "Queue"="Background" }
ZWrite Off
Lighting Off
Fog {Mode Off}
BindChannels {
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
SubShader {
Pass {
SetTexture [_MainTex] {
Combine texture
}
SetTexture [_MainTex] {
constantColor [_Color]
combine previous * constant
}
}
}
}
}
I use it by dragging the /Assets/Tuscany/Models/Prefabs/Skybox.prefab in to my scene, I replaced each material to use the above shader
I also created a script that makes the skybox copy my OVRCamera position but not its rotation:
using UnityEngine;
using System.Collections;
public class MatchPosition : MonoBehaviour {
public Transform ParentPosition;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(ParentPosition !=null)
this.transform.position = ParentPosition.position;
}
}
So this way you can make the sky box small, encompassing both cameras and it will draw first before the entire scene without updating the zbuffer. Also i set both cameras Clear Flags property to Depth Only, since the background will clear the color buffer, you save a little bit of render time.
