| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 | Shader "AVProVideo/VR/InsideSphere Unlit (stereo+fog) Stereo UV"{	Properties	{		_MainTex ("Texture", 2D) = "black" {}		[Toggle(STEREO_DEBUG)] _StereoDebug ("Stereo Debug Tinting", Float) = 0		[Toggle(APPLY_GAMMA)] _ApplyGamma("Apply Gamma", Float) = 0	}	SubShader	{		Tags { "RenderType"="Opaque" "IgnoreProjector" = "True" "Queue" = "Background" }		ZWrite On		//ZTest Always		Cull Front		Lighting Off		Pass		{			CGPROGRAM			#include "UnityCG.cginc"			#include "AVProVideo.cginc"			//#pragma target 3.0			#pragma vertex vert			#pragma fragment frag			//#define STEREO_DEBUG 1			//#define HIGH_QUALITY 1			#pragma multi_compile_fog			// TODO: replace use multi_compile_local instead (Unity 2019.1 feature)			#pragma multi_compile __ STEREO_DEBUG			#pragma multi_compile __ APPLY_GAMMA			struct appdata			{				float4 vertex : POSITION;	// vertex position				float2 uv : TEXCOORD0;		// texture coordinate 1				float2 uv2 : TEXCOORD1;		// texture coordinate 2			};			struct v2f			{				float4 vertex : SV_POSITION; // clip space position				float2 uv : TEXCOORD0; // texture coordinate				UNITY_FOG_COORDS(1)#if STEREO_DEBUG				float4 tint : COLOR;#endif			};			uniform sampler2D _MainTex;			uniform float4 _MainTex_ST;			v2f vert(appdata v)			{				v2f o;				o.vertex = XFormObjectToClip(v.vertex);				if (IsStereoEyeLeft())				{					o.uv.xy = TRANSFORM_TEX(v.uv, _MainTex);					o.uv.xy = float2(1.0 - o.uv.x, o.uv.y);				}				else				{					o.uv.xy = TRANSFORM_TEX(v.uv2, _MainTex);					o.uv.xy = float2(1.0 - o.uv.x, o.uv.y);				}				#if STEREO_DEBUG				o.tint = GetStereoDebugTint(IsStereoEyeLeft());				#endif				UNITY_TRANSFER_FOG(o, o.vertex);				return o;			}			fixed4 frag (v2f i) : SV_Target			{				float2 uv;				uv = i.uv;				fixed4 col = tex2D(_MainTex, uv);#if APPLY_GAMMA				col.rgb = GammaToLinear(col.rgb);#endif#if STEREO_DEBUG				col *= i.tint;#endif				UNITY_APPLY_FOG(i.fogCoord, col);				return fixed4(col.rgb, 1.0);			}			ENDCG		}	}}
 |