-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[V3] colorRampTexture with NEAREST textureFilter #12909
Comments
cc @rreusser |
Good catch, @HiroyukiYANO! I believe what you're seeing is a small misalignment in tabulated color scale texture sampling resulting from the fact that WebGL texture values are defined at the center of each pixel. I have submitted a bug fix which fixes how this sampling is performed internally and which will be released in the near future. Until then, you might try the following workaround:
With this code, you should find that raster tile pixel values map precisely to
Once the fix is released, then You may also find this comment useful, in which I described some of the subtle differences in behavior which result from more of a "categorical" colorization use case instead of a continuous, quantitative color scale: #12368 (comment) Any feedback on the value or shortcomings of this feature are greatly appreciated! 🙇 Hopefully the above workaround is successful, and if so, I think it's still best to leave this issue open until the fix is released. |
Oh, and one small extra note is that you're very correct that a property like |
Thank you for your kindly reply. The result is ... almost OK. with subtract 0.5 from original step value, then it woks fine.
You can see my code example here. |
Ahh, thank you for the followup. I think I failed to shift the expression to compensate for the shifted |
Thank you. I got it. |
Motivation
The TextureFilter of colorRampTexture is now only fixed to 'LINEAR'.
But in some case, the user may wish to use 'NEAREST' for color palette, especially using 'step' expression for raster-color.
No color interpolation is needed arround threshold value.
The attached images area drawn by following paint properties.
Design Alternatives
Design
adding new paint property like
raster-color-resampling: "nearest" | "linear"
("linear" as default)or use existing paint property
raster-resampling
for raster-color-ramp.Mock-Up
Concepts
Implementation
change L130 of draw_raster.js
from
to
The text was updated successfully, but these errors were encountered: