Preview_VertexIdVariableNode.shader 626 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. Shader "Hidden/VertexIdVariableNode"
  2. {
  3. SubShader
  4. {
  5. Pass
  6. {
  7. CGPROGRAM
  8. #include "UnityCG.cginc"
  9. #include "Preview.cginc"
  10. #pragma vertex vert
  11. #pragma fragment frag
  12. struct appdata_custom
  13. {
  14. float4 vertex : POSITION;
  15. uint vertexId : SV_VertexID;
  16. };
  17. struct v2f_custom
  18. {
  19. float4 pos : SV_POSITION;
  20. half vertexId : TEXCOORD0;
  21. };
  22. v2f_custom vert( appdata_custom v )
  23. {
  24. v2f_custom o;
  25. o.pos = UnityObjectToClipPos (v.vertex);
  26. o.vertexId = v.vertexId;
  27. return o;
  28. }
  29. float4 frag( v2f_custom i ) : SV_Target
  30. {
  31. return i.vertexId;
  32. }
  33. ENDCG
  34. }
  35. }
  36. }