Skip to content

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