chuantou.shader 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "PengLu/OccTransVF"
  3. {
  4. Properties
  5. {
  6. _MainTex ("Base (RGB)", 2D) = "white" {}
  7. _RimColor("RimColor",Color) = (0,1,1,1)
  8. _RimPower ("Rim Power", Range(0.1,8.0)) = 1.0
  9. }
  10. SubShader
  11. {
  12. LOD 300
  13. Tags { "Queue" = "Geometry+500" "RenderType"="Opaque" }
  14. Pass
  15. {
  16. Blend SrcAlpha One
  17. ZWrite off
  18. Lighting off
  19. ztest greater
  20. CGPROGRAM
  21. #pragma vertex vert
  22. #pragma fragment frag
  23. #include "UnityCG.cginc"
  24. float4 _RimColor;
  25. float _RimPower;
  26. struct appdata_t {
  27. float4 vertex : POSITION;
  28. float2 texcoord : TEXCOORD0;
  29. float4 color:COLOR;
  30. float4 normal:NORMAL;
  31. };
  32. struct v2f {
  33. float4 pos : SV_POSITION;
  34. float4 color:COLOR;
  35. } ;
  36. v2f vert (appdata_t v)
  37. {
  38. v2f o;
  39. o.pos = UnityObjectToClipPos(v.vertex);
  40. float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
  41. float rim = 1 - saturate(dot(viewDir,v.normal ));
  42. o.color = _RimColor*pow(rim,_RimPower);
  43. return o;
  44. }
  45. float4 frag (v2f i) : COLOR
  46. {
  47. return i.color;
  48. }
  49. ENDCG
  50. }
  51. pass
  52. {
  53. ZWrite on
  54. ZTest less
  55. CGPROGRAM
  56. #pragma vertex vert
  57. #pragma fragment frag
  58. sampler2D _MainTex;
  59. float4 _MainTex_ST;
  60. struct appdata {
  61. float4 vertex : POSITION;
  62. float2 texcoord : TEXCOORD0;
  63. };
  64. struct v2f {
  65. float4 pos : POSITION;
  66. float2 uv : TEXCOORD0;
  67. };
  68. v2f vert (appdata v)
  69. {
  70. v2f o;
  71. o.pos = UnityObjectToClipPos(v.vertex);
  72. o.uv = v.texcoord;
  73. return o;
  74. }
  75. float4 frag (v2f i) : COLOR
  76. {
  77. float4 texCol = tex2D(_MainTex, i.uv);
  78. return texCol;
  79. }
  80. ENDCG
  81. }
  82. }
  83. FallBack "Diffuse"
  84. }