Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is time for another stab at the terrain shader file. I gathered some new insights on what is important to produce the best results possible, partly from looking at BAR maps, partly from looking at maps from @sting-2 and these insights are the basis for the following changes.
The way to achieve the best quality seems have a huge (4-8k) map-wide albedo texture and to interpolate it with the other stratums that provide details. This way the map albedo texture can break up the texture repetition and provide much more color variation than you could by just tiling 8 regular textures.
The mapwide normal should ideally also be huge. To justify thse file sizes we need compression. Until now we stored the shadows, water depth and map normals all in one texture. Compressing these leads to severe artifacts and basically all our inputs are sensitive to artifacts. The dds compression was meant for colors, but if we store non-color data we notice this much more.
But we can utilize a trick. The alpha channel does not suffer from artifacts and the color channels also have basically no compression if we store the same value in all color channels. So we can store two channels per texture, with compression, and it still looks good. We put normals in one texture and our shadows and water depth in another.
An example:
R: normal z
G: normal z
B: normal z
A: normal X
A nice upside of this is that normal decals are compatible to this encoding. So if someone has made a normal decal for their map normals in the past, they can use this texture directly.
By separating the normals from the shadows and water, we can crank up the resolution on the normal texture and choose a lower resolution on our shadows and water, saving even more disk space.
The downside is that we have one more texture now. I changed the slots of our map textures to accomodate this as well as possible.
Previous layout:
upper albedo: map info texture: map normal + water depth + shadow
layer8 albedo: macrotexture with alpha
layer8 normal: heightroughness texture
Now:
upper albedo: heightroughness texture
layer8 albedo: map info texture: ambient occlusion + shadow + water depth
layer8 normal: map normal
I added ambient occlusion because it might be a nice addition and you can sometimes squeeze in three channels into a compressed dds texture without too many artifacts. Alternatively we could maybe store this texture uncompressed because it is not so big. AO is not implemented yet. I need to test it some more. To future-proof the map info texture a pure white should be used in the AO channel.
The macro texture now does not have a dedicated slot anymore. Instead the lower albedo can get used as a macrotexture. Different shader variants will allow control over how the lower albedo gets treated.
Checklist