// Packs the metallic-smoothness WORK layout into the URP _MetallicGlossMap layout. // // While painting, the metallic-smoothness map is kept in a "work" RenderTexture as // R = metallic, G = smoothness, A = coverage (painted marker for the dilation pass). // This lets the same brush + dilate shaders (which use alpha as the coverage marker) // drive it exactly like the albedo map. But URP's _MetallicGlossMap expects // R = metallic, A = smoothness. // This pass converts work -> final after each stroke: out = (work.r, 0, 0, work.g). // // Both work and final are linear RenderTextures (metallic/smoothness are data, not // color), so no gamma conversion happens. Shader "Hidden/MeshPaintPackMS" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType" = "Opaque" } Pass { ZTest Always ZWrite Off Cull Off Blend Off CGPROGRAM #pragma vertex vert_img #pragma fragment frag #include "UnityCG.cginc" sampler2D _MainTex; fixed4 frag (v2f_img i) : SV_Target { fixed4 c = tex2D(_MainTex, i.uv); return fixed4(c.r, 0.0, 0.0, c.g); // R = metallic, A = smoothness } ENDCG } } Fallback Off }