Quick answer: Each splatmap stores 4 terrain layers in its RGBA channels. Layers 5+ require an additional splatmap and a second rendering pass. In URP, enable additional passes in the terrain shader settings and ensure shader variants are not stripped. In Built-in, it works automatically up to 16 layers but each group of 4 costs a full extra draw pass.

Here is how to fix Unity terrain paint texture splatmap limits. You add a fifth terrain layer, paint with it, and nothing appears. The texture slot shows correctly in the Terrain inspector, the layer previews fine in the paint brush list, but painting produces no visible change on the terrain surface. Layers 1 through 4 work perfectly. Layer 5 and beyond are invisible.

The Symptom

After adding a fifth (or ninth, or thirteenth) terrain layer, painting with that layer produces no visible result on the terrain. The alphamap data is being written — you can verify via TerrainData.GetAlphamaps() — but the terrain shader does not render the additional layers. In URP, the terrain may appear black where only the invisible layer has weight.

In the Built-in pipeline, this typically works automatically up to 16 layers. The issue is most common in URP and HDRP where shader variants may be stripped or additional passes must be explicitly enabled.

What Causes This

Splatmap RGBA channel limit. Each splatmap texture is an RGBA texture where each channel stores the blend weight for one terrain layer. Four channels means four layers per splatmap. Layer 5 needs a second splatmap, layer 9 needs a third, and so on.

URP terrain shader layer cap. The URP Terrain Lit shader defaults to a maximum of 4 layers in its base pass. Rendering layers 5–8 requires the shader to perform an additional blending pass. If the _TERRAIN_BLEND_HEIGHT or additional pass keywords are missing, those layers are not sampled.

Shader variant stripping. If you have aggressive shader stripping in your build settings or a custom IPreprocessShaders implementation, the multi-pass terrain variants may be stripped, making them unavailable at runtime even though they work in the editor.

Material override without multi-layer support. If you assigned a custom material to the terrain that only samples the first splatmap, additional splatmaps are ignored entirely.

The Fix

Step 1: Check URP terrain settings. Select your URP Renderer Asset and verify that the terrain settings allow additional passes. In the Universal Renderer Data, look for the terrain rendering configuration.

// Verify terrain alphamap count at runtime
TerrainData td = terrain.terrainData;
Debug.Log("Splatmap count: " + td.alphamapTextureCount);
Debug.Log("Layer count: " + td.terrainLayers.Length);

// If alphamapTextureCount is 1 but layers > 4, the extra splatmap is missing

Step 2: Ensure the terrain material supports multiple passes. For URP, the terrain must use the Universal Render Pipeline/Terrain/Lit shader. Check the material on the Terrain component — if it says “Custom” or uses a non-standard shader, additional layers may not render.

// Force terrain to use the default URP terrain material
Terrain terrain = GetComponent<Terrain>();
terrain.materialTemplate = null; // Resets to default pipeline material

Step 3: Prevent shader variant stripping. In Project Settings > Graphics, add the terrain multi-pass shader variants to the “Always Included Shaders” list, or add a ShaderVariantCollection that includes the terrain keywords for additional passes.

Step 4: Consider the performance cost. Each additional group of 4 layers doubles the terrain rendering cost for those patches. On mobile, keep layers to 4 or fewer. On desktop, 8 layers is usually fine but 12+ can become expensive on large terrains.

// Runtime layer count check for mobile builds
void ValidateTerrainLayers(TerrainData data)
{
    int maxLayers = 4;
    #if !UNITY_ANDROID && !UNITY_IOS
    maxLayers = 8;
    #endif

    if (data.terrainLayers.Length > maxLayers)
        Debug.LogWarning("Terrain exceeds recommended layer count for this platform");
}

Alternative: Texture Arrays

For terrains needing many layers without the multi-pass cost, custom terrain shaders using Texture2DArray can sample all layers in a single pass. This requires a custom shader that indexes into the array using the splatmap weights, but avoids the per-4-layer pass overhead. Several Asset Store solutions implement this approach.

Understanding the issue

AI bugs are emergent. The code is correct in isolation; the behavior emerges from interaction with other systems. Reproducing means controlling the interaction; fixing means deciding which interaction was wrong.

The specific bug described above is the kind that surfaces during integration rather than unit testing. It depends on a combination of factors: the asset configuration, the runtime state, the platform's specific behavior. In isolation, each piece looks correct; in combination, the bug emerges. This is why thorough integration testing - playing the actual game in realistic conditions - catches things that automated tests miss.

Why this happens

Bugs of this class are particularly easy to ship past internal QA because they often depend on specific runtime conditions - hardware combinations, network states, or asset configurations that QA didn't reproduce. Players hit them in the wild, file reports that are hard to repro, and the bug accumulates negative reviews while engineering tries to recreate the failure mode.

At the engine level, the behavior comes from a deliberate design decision in Unity. The engine team chose a particular trade-off - usually performance versus convenience, or generality versus specificity - and that trade-off has consequences when you push against it. Understanding the trade-off is what turns 'this bug is mysterious' into 'this bug is the expected consequence of this design'.

Verifying the fix

Verifying this fix in isolation is straightforward: reproduce the bug, apply the change, confirm the bug no longer reproduces. The harder verification is regression - did this fix introduce a new bug elsewhere? Run your standard regression suite, plus any tests that exercise the same code path with different inputs.

Reproducibility is the prerequisite for verification. If you can't reliably reproduce the bug pre-fix, you can't reliably verify it post-fix. Spend time getting a clean reproduction before you write any fix code. The fix is fast once you understand the reproduction; the reproduction is the slow part.

Variations to watch for

Related bug classes often share the same root cause. If you find yourself fixing this issue, look for cousins: similar symptoms in adjacent systems, the same data flow but a different value, or the same fix pattern in another module. The catalog of 'we've seen this before' becomes valuable institutional knowledge.

Adjacent bugs often share a root cause. After fixing the case you've found, spend an hour searching the codebase for similar patterns. What's the same call with different arguments? The same data flow with a different entity type? The same lifecycle issue in a sibling system? Each match is a candidate for the same fix, or a related fix that prevents future bugs of the same class.

In production

For shipping titles with a long support window, watch for this issue resurfacing after dependency updates. Engine upgrades, driver updates, OS releases - each one can resurface a bug class you thought you'd fixed because the underlying behavior changed slightly. Regression tests catch the obvious ones; player reports catch the rest.

When triaging a similar issue in production, prioritize gathering data over hypothesizing causes. A player report describes a symptom; what you need is a build SHA, a session timestamp, and ideally a screen recording or session replay. With those, the bug becomes tractable. Without them, you're guessing at hypothetical reproductions that may not match what the player actually hit.

Performance considerations

Performance implications matter when this bug class scales with player count or asset count. A bug that fires once per session is annoying; a bug that fires once per frame compounds. After fixing, profile the affected code path under realistic load. The fix that's correct for one entity may be too slow for ten thousand.

Diagnostic approach

The diagnostic tools available depend on your engine and platform. Use the engine's native profilers and debug overlays before reaching for external tools. The native tools have context that external tools lack - they know which subsystem owns the code, which assets are loaded, and what state the engine is in.

For Unity-specific diagnostics, the editor's profiler is the canonical starting point. Capture a representative frame with the symptom present; compare against a frame without the symptom; the diff often points directly at the cause. If the symptom is non-deterministic, capture multiple frames and look for the pattern - the cause is usually a state transition or a specific input value rather than a continuous effect.

Tooling and ecosystem

Third-party plugins often provide better diagnostics for their own behavior than the engine does. If the affected code is in a plugin, check the plugin's documentation for debug modes, verbose logging, or inspector tools - these can save hours of investigation when they exist.

Within Unity, the relevant diagnostic surfaces include the standard frame debugger, memory profiler, and engine-specific debug overlays. Each one shows a different facet of what's happening. The frame debugger reveals draw call ordering and state transitions; the memory profiler shows allocation patterns; the debug overlay reveals per-system state. Bugs that resist one tool usually surrender to another - the trick is knowing which tool to reach for first.

Edge cases and pitfalls

Boundary conditions deserve specific testing attention. What happens when the input is zero, maximum, negative, or NaN? What happens at the start of a session vs hours in? What happens at the boundary between two systems handling the same data? These are where bugs hide and where regression tests are most valuable.

When writing a regression test for this fix, focus on the boundary conditions that surfaced the original bug. Tests that exercise the happy path catch obvious regressions; tests that exercise the boundary catch the subtler regressions that look like new bugs but are really the original returning. The latter are the tests that earn their keep over the long life of the project.

Team communication

When this bug class affects multiple teams (often the case for cross-system issues), early communication prevents duplicate work. The team that owns the symptom may not own the cause. A 15-minute conversation at the start of triage often saves hours of independent investigation.

If this fix touches a system several engineers work in, a short writeup in the team's engineering channel helps. Not a full design doc - a paragraph explaining what was wrong, what's fixed, and what to watch for. Future engineers encountering similar symptoms will search for the fix; making it findable is a small investment that pays back later.

“Four layers per splatmap is not a bug — it is RGBA. If you need a fifth, you need a second texture and a second pass to read it.”

Verifying the Fix

After applying the correct material and verifying shader variants, repaint with layer 5. The texture should now appear. Check TerrainData.alphamapTextureCount at runtime to confirm multiple splatmaps are allocated. In the Frame Debugger, you should see two terrain draw calls for patches that use layers from both splatmaps.

Terrain rendering is one of the few places where Unity still uses multi-pass by default. Each splatmap group costs a full pass — budget accordingly.