SingleLine-TextureAdditive.shader 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /// Render a single volumetric line using an additive shader which does not support changing the color
  2. ///
  3. /// Based on the Volumetric lines algorithm by Sebastien Hillaire
  4. /// http://sebastien.hillaire.free.fr/index.php?option=com_content&view=article&id=57&Itemid=74
  5. ///
  6. /// Thread in the Unity3D Forum:
  7. /// http://forum.unity3d.com/threads/181618-Volumetric-lines
  8. ///
  9. /// Unity3D port by Johannes Unterguggenberger
  10. /// johannes.unterguggenberger@gmail.com
  11. ///
  12. /// Thanks to Michael Probst for support during development.
  13. ///
  14. /// Thanks for bugfixes and improvements to Unity Forum User "Mistale"
  15. /// http://forum.unity3d.com/members/102350-Mistale
  16. ///
  17. /// Shader code optimization and cleanup by Lex Darlog (aka DRL)
  18. /// http://forum.unity3d.com/members/lex-drl.67487/
  19. ///
  20. /// Single Pass Stereo Support by Unity Forum User "Abnormalia_"
  21. /// https://forum.unity.com/members/abnormalia_.356336/
  22. ///
  23. /// Single pass instanced rendering fix by Niel
  24. ///
  25. Shader "VolumetricLine/SingleLine-TextureAdditive" {
  26. Properties {
  27. [NoScaleOffset] _MainTex ("Base (RGB)", 2D) = "white" {}
  28. _LineWidth ("Line Width", Range(0.01, 100)) = 1.0
  29. _LineScale ("Line Scale", Float) = 1.0
  30. }
  31. SubShader {
  32. // batching is forcefully disabled here because the shader simply won't work with it:
  33. Tags {
  34. "DisableBatching"="True"
  35. "RenderType"="Transparent"
  36. "Queue"="Transparent"
  37. "IgnoreProjector"="True"
  38. "ForceNoShadowCasting"="True"
  39. "PreviewType"="Plane"
  40. }
  41. LOD 200
  42. Pass {
  43. Cull Off
  44. ZWrite Off
  45. ZTest LEqual
  46. Blend One One
  47. Lighting Off
  48. CGPROGRAM
  49. #pragma glsl_no_auto_normalization
  50. #pragma vertex vert
  51. #pragma fragment frag
  52. #include "_SingleLineShader.cginc"
  53. ENDCG
  54. }
  55. }
  56. FallBack "Diffuse"
  57. }