Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a checkbox for bilinear filtering of color and altitude #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SudoMike
Copy link

Bilinear filtering makes hills look smoother, but it makes intentionally-angular things like the pyramids in the example maps look weird.

Bilinear filtering makes hills look smoother, but it makes intentionally-angular things like the pyramids in the example maps look weird.
var b2 = b & 0xFF;

var invt = 1.0 - t;
return 0xFF000000 |
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Performance could probably could be improved on by using fixed point math here, depending on what the JIT compiler does.

// 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);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant