Fixes blending issues while respecting #1704 #2049
Open
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.
The corrections to the blendTotal were reverted due to issue #1704 . This will revert that revert, while also making the terrain render in a single pass (at least for up to ~20 textures layers per terrain cell, which should be reasonable).
In order to allow rendering the terrain in a single pass, I had to move some calculations from vertex to pixel shader, so a benchmark on how this affects performance should definetly be considered.
In theory, it should be possible to solve this issue with the multi-pass rendering technique utilized currently, but I haven't been able to make it work.
Edit: Furthermore, due to an issue where you can't get the constNum of a texture, the code is a bit ugly and difficult to maintain, as it assumes a specific ordering in the shader's texture constants. Should only be an issue when someone messes with that part of the terrain shader though.
Edit2: Clarified it is 20 texture layers and not 20 textures.