UnlitTexture.shader 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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/UnlitTexture" {
  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. return tex2D(_MainTex, i.uv) * i.color * _Color;
  55. }
  56. ENDCG
  57. }
  58. }
  59. }