Epic is probably aware of this bug because it’s been around since the start.
But I’m just making a thread for it maybe it will get sorted out.
When painting landscape layers there is this grey square bug happening randomly on sectors of the landscape we paint.
It happens almost all the times when having more than 1-3 really simple layers.
Painting the entire landscape with each layer individually, then trying to paint and mix them as we want. Still the square happens, less, but still there.
And I can probably paste a hundred other links where people have the similar problem.
It’s a problem with too many textures samples (more than 16) for certain components, because, as far as I understand, UE4 compiles landscape material separtely per component given the amount of different layers. If you paint on a component all the layers (on different places) you will probably end with shader compiling (unless you have already done it) and if there are a lot of samples, including base color, masks, roughness, displacement or normal, it won’t compile because it will exceed 16 samples. If you check console you should see some errors. Reducing samples, removing normals when they are superflus or reducing the amount of layers can be a good start
so is it 3 or 4? and do you have any other textures in your material? like a general overlay or something?
with 4 layers using only diffuse+normal it really should be fine, but I suspect you’re using more than just this.
Not really. I will repro the issue and attach an example level when I have time.
But after all, one should not simply limit their creativity just to prevent a bug right? you should be able to have like 10 different layers or even more. It’s the compiling bug thats needed to get fixed, not reducing the texture maps and keeping them around 4-5 at most.
it’s not a bug per se, it’s a graphics hardware limitation (texture sampler limit) coupled up with a rather naive (or not powerful/flexible enough) implementation of terrain texturing.
the problem is the way it handles its texturing.
I don’t know how it is in other modern game engines, but traditionally the method was to use vertex colors’ RGBA channels as texture blending channels. this means you could only ever paint 4 “layers” of textures.
UE3’s landscape system allows painting more layers because it uses multiple splat textures’ RGBA (every 4 painted layers use a new splat texture, so 12 layers already mean you use 3 splat textures) - every landscape vertex is mapped to one pixel in the splat texture.
in the traditional method, some engines were able to blend quite a larger number of textures across the whole terrain (but still, always a very small amount of textures blended per vertex). I can only guess what kind of trickery they used to overcome the texture sampler hardware limitations but I don’t know for sure how it was done. I know many games have quite more than 4 textures per terrain, but never did I see more than 4 textures blended in one same place.
I can think of several games that allowed painting of virtually unlimited textures per terrain (maybe there was a limit), usually strategy games like the Age of Empires games (not sure if the 3D ones had it tho, and the 2D ones would be irrelevant), Might & Magic Heroes 6 had unlimited, and Warcraft3 had a big amount.
but in UE3/UE4 the separation was done per component. you can blend a lot of textures in one point, but paint more textures in a component than you should and you’ll just surpass the hardware limitation and the shader will not be able to be compiled.
and the problem is, communicating this limitation was never done properly by the editor (neither UDK nor UE4). not that it’s an easy thing to communicate either.
with the new neat SM5 trick they made recently you can paint up to 128 textures, but only applies to SM5 hardware (PC only). for all other platforms the problem still persists.
personally I’d prefer a system that blends less textures per vertex, but allows more variety across the board. it’d probably be more performant as well.
@Chosker, thanks for the well written explanation.
The good news is I’ve got a job to do for a client and so far I’m having 5 layers and that grey sector issues is not happening anymore in 4.9. I’ll try increasing the layer count as I go and report back.
I had the same problem and RyanB’s reply on another thread related to the same topic gave me the answer.
In your landscape material, select all texture samples and set the ‘Sampler Source’ to ‘Shared:Wrap’.