WireframeVideoOverlay.shader 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 
  2. ///======= Copyright (c) Stereolabs Corporation, All rights reserved. ===============
  3. ///
  4. /// Basic wireframe shader that can be used for rendering spatial mapping meshes.
  5. ///
  6. Shader "Custom/Spatial Mapping/ WireframeViedoOverlay"
  7. {
  8. Properties
  9. {
  10. _WireColor("Wire color", Color) = (1.0, 1.0, 1.0, 1.0)
  11. }
  12. SubShader
  13. {
  14. Tags{ "RenderType" = "Opaque" }
  15. Lighting Off
  16. Pass
  17. {
  18. CGPROGRAM
  19. #pragma vertex vert
  20. #pragma fragment frag
  21. #include "UnityCG.cginc"
  22. struct appdata
  23. {
  24. float4 vertex : POSITION;
  25. float2 uv : TEXCOORD0;
  26. };
  27. struct v2f
  28. {
  29. float2 uv : TEXCOORD0;
  30. float4 vertex : SV_POSITION;
  31. float dist : TEXCOORD1;
  32. };
  33. sampler2D _MainTex;
  34. float4 _MainTex_ST;
  35. float4 _WireColor;
  36. v2f vert(appdata v)
  37. {
  38. v2f o;
  39. o.vertex = UnityObjectToClipPos(v.vertex);
  40. o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  41. o.dist = length(ObjSpaceViewDir(v.vertex));
  42. return o;
  43. }
  44. float4 frag(v2f i) : SV_Target
  45. {
  46. float4 color = _WireColor;
  47. //#if AWAYS
  48. color.a = 10 / (0.1 + i.dist*i.dist);
  49. //#endif
  50. return color;
  51. }
  52. ENDCG
  53. }
  54. }
  55. Fallback off
  56. }