Splat maps artifacts between layers

I’m generating a terrain procedurally and trying to set the splay maps,
I’m doing so in a shader that takes in 2 textures 1 for each layer, then I make sure their sum is equal to 1.
then I’m copying the texture into the splat map texture using CopyActiveRenderTextureToTexture.

The problem is that I get a lighter color in the fade between the layers as shown in the image.
Any suggestions on how to correct this?

the render texture format is “ARGB32”
there is nothing fancy in the code, just a simple texture copy and source over backdrop blending.
here is the shader code

fixed4 frag(v2f i) : SV_Target
            {
                float b = tex2D(_MainTex, i.uv).r;
                float s = tex2D(_TexB, i.uv).r;

                return float4(b * (1-s), s, 0, 0);
            }

here is the C# code that copies the texture

RectInt splatRect = new RectInt(0, 0, terrainData.alphamapResolution, terrainData.alphamapResolution);
        RenderTexture.active = mapData.splat0;
        terrainData.CopyActiveRenderTextureToTexture(TerrainData.AlphamapTextureName, 0, splatRect, new Vector2Int(0, 0), false);

8982199--1235914--upload_2023-4-29_23-0-13.png

That was quicker then I thought :slight_smile:
needed to set: sRGB = false;
Now it works properly

1 Like