-
-
Notifications
You must be signed in to change notification settings - Fork 323
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
Improve nan handling in surface plots #4735
Conversation
Benchmark ResultsSHA: c163ff80628bf12358353b37799595a54b948857 Warning These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking. |
How do we draw the position if it's Nan? This looks to me like the position comes from the x/y range, which then isn't Nan? |
I wonder if we should view the lines of lowclip/highclip colors in "heatmaps & surface" as correct. I.e.: data = hcat(LinRange(2, 3, 4), LinRange(2, 2.5, 4), LinRange(2.5, 3, 4), [1, NaN, NaN, 5])
surface(
zeros(size(data)),
color = data,
colorrange = (2, 3),
highclip = :red,
lowclip = :black,
nan_color = (:green, 0.5),
shading = NoShading,
) OpenGL is not mixing in the nan values there, because we're going straight from the color =1 (5) vertex to the color = 2.5 (3) vertex. While the test looks weird like this, it does seem reasonable to me. |
@jkrumbiegel do you have an opinion about the lowclip/highclip here? |
looks weird but can't be avoided if opengl only looks at those two vertices I guess |
Description
This started from investigating why the "heatmaps & surface" test produces different nan colors in GLMakie and WGLMakie.
As far as I understand Three.js filters nan values from interleaved buffers. So if any positional argument is nan in WGLMakie, the instances/rects that include that position do not get rendered. That seems like the correct behavior to me. If any part of the position is nan, then we cannot draw a rect with it. I believe that is also the conclusion we came to with #2598 at Makiecon.
So it's GLMakie that's actually wrong. Turns out we never really dealt with the problem there on a position level. The rects are still drawn, it's just that their color is nan and therefore uses nan_color which is transparent by default.
Changes/TODO:
(CairoMakie) discard nan rectsalready happens on position basis and would require reworking color handling/surface rendering pipeline for colors, which seems like more work than it's worthType of change
Checklist