Added a checkbox for bilinear filtering of color and altitude - #17
Open
SudoMike wants to merge 1 commit into
Open
Added a checkbox for bilinear filtering of color and altitude#17SudoMike wants to merge 1 commit into
SudoMike wants to merge 1 commit into
Conversation
Bilinear filtering makes hills look smoother, but it makes intentionally-angular things like the pyramids in the example maps look weird.
SudoMike
commented
Nov 23, 2022
| var b2 = b & 0xFF; | ||
|
|
||
| var invt = 1.0 - t; | ||
| return 0xFF000000 | |
Author
There was a problem hiding this comment.
Performance could probably could be improved on by using fixed point math here, depending on what the JIT compiler does.
SudoMike
commented
Nov 23, 2022
| // between those to get the final color. | ||
| var upper_color = ColorInterp(map.color[ulindex], map.color[urindex], plxt); | ||
| var lower_color = ColorInterp(map.color[llindex], map.color[lrindex], plxt); | ||
| final_color = ColorInterp(lower_color, upper_color, plyt); |
Author
There was a problem hiding this comment.
Perf improvement opportunity (probably minor): decompose the 4 corners from uint32's into RGB values ahead of time (better yet, make map.color already store separate R, G, and B values), do the bilinear filtering, and then recompose only at the end. This would save recomposing upper_color and lower_color into uint32's, then immediately decomposing them again.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bilinear filtering makes hills look smoother, but it makes intentionally-angular things like the pyramids in the example maps look weird.