BuildPBRMetallicMap.shader 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Shader "Hidden/TriLib/BuildPBRMetallicMap"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Texture", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. // No culling or depth
  10. Cull Off ZWrite Off ZTest Always
  11. Pass
  12. {
  13. CGPROGRAM
  14. #pragma vertex vert
  15. #pragma fragment frag
  16. #include "UnityCG.cginc"
  17. struct appdata
  18. {
  19. float4 vertex : POSITION;
  20. float2 uv : TEXCOORD0;
  21. };
  22. struct v2f
  23. {
  24. float2 uv : TEXCOORD0;
  25. float4 vertex : SV_POSITION;
  26. };
  27. v2f vert (appdata v)
  28. {
  29. v2f o;
  30. o.vertex = UnityObjectToClipPos(v.vertex);
  31. o.uv = v.uv;
  32. return o;
  33. }
  34. sampler2D _MetallicTexture;
  35. sampler2D _SpecularTexture;
  36. fixed4 frag (v2f i) : SV_Target
  37. {
  38. fixed4 metallic = tex2D(_MetallicTexture, i.uv);
  39. fixed4 specular = tex2D(_SpecularTexture, i.uv);
  40. return fixed4(metallic.yyy, specular.x);
  41. }
  42. ENDCG
  43. }
  44. }
  45. }