Preview_HeightMapTextureBlend.shader 689 B

12345678910111213141516171819202122232425262728293031323334
  1. Shader "Hidden/HeightMapTextureBlend"
  2. {
  3. Properties
  4. {
  5. _A ("_A", 2D) = "white" {}
  6. _B ("_B", 2D) = "white" {}
  7. _C ("_C", 2D) = "white" {}
  8. }
  9. SubShader
  10. {
  11. Pass
  12. {
  13. CGPROGRAM
  14. #include "UnityCG.cginc"
  15. #include "Preview.cginc"
  16. #pragma vertex vert_img
  17. #pragma fragment frag
  18. sampler2D _A;
  19. sampler2D _B;
  20. sampler2D _C;
  21. float4 frag( v2f_img i ) : SV_Target
  22. {
  23. float heightmap = tex2D( _A, i.uv ).x;
  24. float splatMask = tex2D( _B, i.uv ).x;
  25. float blendStrength = tex2D( _C, i.uv ).x;
  26. float result = saturate( pow((( heightmap*splatMask ) * 4 ) + ( splatMask * 2 ), blendStrength ));
  27. return float4( result.x , 0, 0, 1 );
  28. }
  29. ENDCG
  30. }
  31. }
  32. }