// Packs the mask-map WORK layout into the URP mask-map layout. // // While painting, the mask map is kept in a "work" RenderTexture as // R = metallic, G = smoothness, B = occlusion, A = coverage (painted marker for dilation). // This lets the same brush + dilate shaders (which use alpha as the coverage marker) // drive it exactly like the albedo map. The packed result is one texture bound to BOTH // _MetallicGlossMap (URP reads R = metallic, A = smoothness) and // _OcclusionMap (URP reads G = occlusion). // This pass converts work -> final after each stroke: out = (work.r, work.b, 0, work.g) // = (metallic, occlusion, 0, smoothness). // // Both work and final are linear RenderTextures (these 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); // work (R=metallic, G=smoothness, B=occlusion) -> (metallic, occlusion, 0, smoothness) return fixed4(c.r, c.b, 0.0, c.g); } ENDCG } } Fallback Off }