stereo rendering shader
This commit is contained in:
1 parent
1c8bcc5001
commit
ada9e96f13
1 file changed
+13
@@ -48,6 +48,8 @@ Shader "Mapbox/Raster With Transparency"
|
||||
float4 vertex : POSITION;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct vertexOut
|
||||
@@ -56,11 +58,19 @@ Shader "Mapbox/Raster With Transparency"
|
||||
float2 uv : UV_COORD0;
|
||||
float4 color : COLOR;
|
||||
float2 screenspaceUv : UV_COORD1;
|
||||
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
vertexOut vert(vertexIn v)
|
||||
{
|
||||
vertexOut o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v); //Insert
|
||||
UNITY_INITIALIZE_OUTPUT(vertexOut, o); //Insert
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); //Insert
|
||||
|
||||
o.pos = UnityObjectToClipPos (v.vertex);
|
||||
o.color = v.color;
|
||||
o.uv = v.texcoord.xy;
|
||||
@@ -70,6 +80,9 @@ Shader "Mapbox/Raster With Transparency"
|
||||
|
||||
fixed4 frag(vertexOut o) : SV_Target
|
||||
{
|
||||
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(o);
|
||||
|
||||
float2 uv = TRANSFORM_TEX(o.uv, _MainTex);
|
||||
fixed4 texColor = tex2D(_MainTex, uv);
|
||||
|
||||
|
||||
Reference in new issue
Block a user