UnlitTextureOffaxis.shader 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. // Copyright 2016 Nibiru. All rights reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. Shader "NAR/UnlitTextureOffaxis" {
  16. Properties {
  17. _Color ("Color", Color) = (1,1,1,1)
  18. _MainTex ("Texture", 2D) = "white" {}
  19. }
  20. SubShader {
  21. Tags { "RenderType"="Opaque" }
  22. Cull Off
  23. Blend Off
  24. ZTest Always
  25. ZWrite Off
  26. Lighting Off
  27. Fog {Mode Off}
  28. Pass {
  29. CGPROGRAM
  30. #pragma vertex vert
  31. #pragma fragment frag
  32. #include "UnityCG.cginc"
  33. struct appdata {
  34. float4 vertex : POSITION;
  35. float4 color : COLOR;
  36. float2 uv : TEXCOORD0;
  37. };
  38. struct v2f {
  39. float2 uv : TEXCOORD0;
  40. float4 color : COLOR;
  41. float4 vertex : SV_POSITION;
  42. };
  43. sampler2D _MainTex;
  44. float4 _MainTex_ST;
  45. float4 _Color;
  46. v2f vert (appdata v) {
  47. v2f o;
  48. o.vertex = UnityObjectToClipPos(v.vertex);
  49. o.color = v.color;
  50. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  51. return o;
  52. }
  53. fixed4 frag (v2f i) : COLOR {
  54. if (i.uv.x < 0.035 || i.uv.x > 0.965 || i.uv.y < 0.04 || i.uv.y > 0.965) return (1,1,0,0);
  55. return tex2D(_MainTex, i.uv) * i.color * _Color;
  56. }
  57. ENDCG
  58. }
  59. }
  60. }