BuildHDRPMask.shader 1.3 KB

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