You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
547 B

  1. Shader "Hidden/VertexTangentNode"
  2. {
  3. SubShader
  4. {
  5. Pass
  6. {
  7. CGPROGRAM
  8. #pragma vertex vert_img
  9. #pragma fragment frag
  10. #include "UnityCG.cginc"
  11. float4 frag( v2f_img i ) : SV_Target
  12. {
  13. float2 tp = 2 * i.uv - 1;
  14. float tr = sqrt( dot(tp,tp) );
  15. tr = saturate( tr );
  16. //if ( tr < 1 ) {
  17. float2 tuvs;
  18. float f = ( 1 - sqrt( 1 - tr ) ) / tr;
  19. float3 tangent = normalize(float3( (1-f)*2, tp.y*0.01, tp.x ));
  20. return float4((tangent), 1);
  21. //}
  22. //else {
  23. // return 0;
  24. //}
  25. }
  26. ENDCG
  27. }
  28. }
  29. }