ZED_Unlit.shader 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Shader "ZED/ZED_Unlit"
  2. {
  3. Properties
  4. {
  5. _MainTexLeft("Texture", 2D) = "white" {}
  6. _MainTexRight("Texture", 2D) = "white" {}
  7. }
  8. SubShader
  9. {
  10. Tags { "RenderType" = "Opaque" }
  11. LOD 100
  12. Pass
  13. {
  14. CGPROGRAM
  15. #pragma vertex vert
  16. #pragma fragment frag
  17. #include "UnityCG.cginc"
  18. struct appdata
  19. {
  20. float4 vertex : POSITION;
  21. float2 uvLeft : TEXCOORD0;
  22. float2 uvRight : TEXCOORD1;
  23. UNITY_VERTEX_INPUT_INSTANCE_ID
  24. };
  25. struct v2f
  26. {
  27. float2 uvLeft : TEXCOORD0;
  28. float2 uvRight : TEXCOORD1;
  29. float4 vertex : SV_POSITION;
  30. UNITY_VERTEX_INPUT_INSTANCE_ID
  31. UNITY_VERTEX_OUTPUT_STEREO
  32. };
  33. sampler2D _MainTexLeft;
  34. float4 _MainTexLeft_ST;
  35. sampler2D _MainTexRight;
  36. float4 _MainTexRight_ST;
  37. v2f vert(appdata v)
  38. {
  39. v2f o;
  40. UNITY_SETUP_INSTANCE_ID(v);
  41. UNITY_INITIALIZE_OUTPUT(v2f, o);
  42. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  43. o.vertex = UnityObjectToClipPos(v.vertex);
  44. o.uvLeft = TRANSFORM_TEX(v.uvLeft, _MainTexLeft);
  45. o.uvRight = TRANSFORM_TEX(v.uvRight, _MainTexRight);
  46. return o;
  47. }
  48. fixed4 frag(v2f i) : SV_Target
  49. {
  50. UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
  51. if (unity_StereoEyeIndex == 0) {
  52. return tex2D(_MainTexLeft, i.uvLeft);
  53. }
  54. else return tex2D(_MainTexRight, i.uvRight);
  55. }
  56. ENDCG
  57. }
  58. }
  59. }