- Home /
Steam VR Camera (Vive) and frag shader coordinate weirdness
I'm getting a weird coordinate mismatch while using the SteamVR camera asset with a Vive.
In this simple RGB cube CG shader example, the cube is still in the scene but as the headset turns or zooms in, the colors all change suddenly at certain points, as if the coordinate system has shifted even though the only thing moving is the camera. This often occurs at the edge of the camera fov, but sometimes at other intervals.
This happens to greater or lesser degree with every set of tags and Z-buffer options I've tried, but seems specific to the SteamVR camera.
Any ideas?
[1]: /storage/temp/72750-screenshot-4.png
http://answers.unity3d.com/storage/temp/72749-screenshot-5.png
Shader "Cg shader for RGB cube" {
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
struct vertexOutput {
float4 pos : SV_POSITION;
float4 col : TEXCOORD0;
};
vertexOutput vert(float4 vertexPos : POSITION)
// vertex shader
{
vertexOutput output; // we don't need to type 'struct' here
output.pos = mul(UNITY_MATRIX_MVP, vertexPos);
output.col = vertexPos + float4(0.5, 0.5, 0.5, 0.0);
return output;
}
float4 frag(vertexOutput input) : COLOR
{
return input.col;
}
ENDCG
}
}
}
screenshot-5.png
(210.0 kB)
screenshot-4.png
(233.7 kB)
Comment