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.

53 lines
877 B

  1. Shader "Hidden/SubstanceSamplerNode"
  2. {
  3. Properties
  4. {
  5. _A ("_UV", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Pass
  10. {
  11. CGPROGRAM
  12. #include "UnityCG.cginc"
  13. #pragma vertex vert_img
  14. #pragma fragment frag
  15. sampler2D _A;
  16. sampler2D _GenTex;
  17. int _CustomUVs;
  18. float4 frag( v2f_img i ) : SV_Target
  19. {
  20. float2 uvs = i.uv;
  21. if( _CustomUVs == 1 )
  22. uvs = tex2D( _A, i.uv ).xy;
  23. float4 genTex = tex2D( _GenTex, uvs);
  24. return genTex;
  25. }
  26. ENDCG
  27. }
  28. Pass
  29. {
  30. CGPROGRAM
  31. #include "UnityCG.cginc"
  32. #pragma vertex vert_img
  33. #pragma fragment frag
  34. sampler2D _A;
  35. sampler2D _GenTex;
  36. int _CustomUVs;
  37. float4 frag( v2f_img i ) : SV_Target
  38. {
  39. float2 uvs = i.uv;
  40. if( _CustomUVs == 1 )
  41. uvs = tex2D( _A, i.uv ).xy;
  42. float3 genTex = UnpackNormal( tex2D( _GenTex, uvs ) );
  43. return float4( genTex, 0 );
  44. }
  45. ENDCG
  46. }
  47. }
  48. }