SteamVR_ColorOut.shader 911 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //======= Copyright (c) Valve Corporation, All rights reserved. ===============
  2. // UNITY_SHADER_NO_UPGRADE
  3. Shader "Custom/SteamVR_ColorOut" {
  4. Properties { _MainTex ("Base (RGB)", 2D) = "white" {} }
  5. CGINCLUDE
  6. #include "UnityCG.cginc"
  7. sampler2D _MainTex;
  8. struct v2f {
  9. float4 pos : SV_POSITION;
  10. float2 tex : TEXCOORD0;
  11. };
  12. v2f vert(appdata_base v) {
  13. v2f o;
  14. #if UNITY_VERSION >= 540
  15. o.pos = UnityObjectToClipPos(v.vertex);
  16. #else
  17. o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
  18. #endif
  19. o.tex = v.texcoord;
  20. return o;
  21. }
  22. float luminance(float3 color)
  23. {
  24. return 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
  25. }
  26. float4 frag(v2f i) : COLOR {
  27. float4 color = tex2D(_MainTex, i.tex);
  28. return float4(color.rgb, 1);
  29. }
  30. ENDCG
  31. SubShader {
  32. Pass {
  33. ZTest Always Cull Off ZWrite Off
  34. Fog { Mode Off }
  35. CGPROGRAM
  36. #pragma vertex vert
  37. #pragma fragment frag
  38. ENDCG
  39. }
  40. }
  41. }