TrailRenderer.shader 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Shader "Custom/TrailRenderer" {
  2. Properties {
  3. _MainTex ("Base (RGB)", 2D) = "white" {}
  4. }
  5. SubShader {
  6. Tags { "RenderType"="Transparent" "IgnoreProjector"="True" "Queue"="Transparent"}
  7. LOD 200
  8. Blend SrcAlpha OneMinusSrcAlpha
  9. CGPROGRAM
  10. #pragma surface surf NoLight vertex:vert alpha noforwardadd
  11. //光照方程,名字为Lighting接#pragma suface后的光照方程名称
  12. //lightDir :顶点到光源的单位向量
  13. //viewDir :顶点到摄像机的单位向量
  14. //atten :关照的衰减系数
  15. float4 LightingNoLight(SurfaceOutput s, float3 lightDir,half3 viewDir, half atten)
  16. {
  17. float4 c ;
  18. c.rgb = s.Albedo;
  19. c.a = s.Alpha;
  20. return c;
  21. }
  22. sampler2D _MainTex;
  23. fixed4 _SelfCol;
  24. struct Input
  25. {
  26. float2 uv_MainTex;
  27. float4 vertColor;
  28. };
  29. void vert(inout appdata_full v, out Input o)
  30. {
  31. o.vertColor = v.color;
  32. o.uv_MainTex = v.texcoord;
  33. }
  34. void surf (Input IN, inout SurfaceOutput o)
  35. {
  36. half4 c = tex2D (_MainTex, IN.uv_MainTex);
  37. o.Alpha = c.a * IN.vertColor.a;
  38. o.Albedo = IN.vertColor.rgb;
  39. }
  40. ENDCG
  41. }
  42. FallBack "Diffuse"
  43. }