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
The correct way to hide scatterplot items and practical count limits? #3068
Comments
@bclinkinbeard When you change the radius of points (and fire the To get really good performance with millions of points you need to do computations on the GPU (i.e. in the shaders). In this case, this probably requires writing a custom subclass and making some addition to the existing scatterplot layer shader code. If you think you are up to that it we could give you a few ideas for how to start. |
Hey Ib, that would be great. I'm definitely willing to give it a shot so any pointers are much appreciated. Thanks! |
So the GPU first runs a vertex shader on every vertex in the geometry and then a fragment shader on every rendered pixel.
To understand where to start, do any of these statements make sense? Look through existing shaders and see if you can see similar patterns. |
Hey Ib, that does make sense. I actually have my timestamps in a TypedArray already, in two different ways. I have a "vanilla" overlay and an Apache Arrow overlay, so I have both row and column encodings. I've started looking at the ScatterplotLayer source, can I just subclass that and provide my own shaders? |
Not quite sure what you mean with "overlay", but yes you want contiguous columnar data, i.e. just one timestamp per object. For Arrow I expect you'd just do
Yes, there is a Make sure you have read this page https://github.com/uber/deck.gl/blob/master/docs/developer-guide/custom-layers/subclassed-layers.md The |
Hey Ib, with #3076 resolved I've come back to this and made some progress. I'm successfully filtering in the shader, but I'm not sure how to trigger updates in a performant way. I followed your suggestions and added
Where I'm a bit stuck is how to trigger re-renders without incurring a bunch of CPU work that makes everything lag. I think the recommended approach is to call |
To clarify a bit, the |
OK, after fighting with this all day (and night) I have something functional, but I hope it's not right. I'm still seeing significant jank with less than 1M points, even though I've confirmed my accessors are not being rerun. When my time scrubber changes I do the following.
The performance is actually worse than what I've gotten out of the CPU before. Hopefully I'm just holding it wrong? |
Arrow's
|
No you should not be able to notice any degradation from that GPU code. As a first step, try setting Just set the value in the console prompt in the debugger. |
Thanks, I was able to do this for my custom attribute but not for
Setting it to 1 doesn't output anything, and anything above 1 produces the error I think my primary question at this point is what do I do when my custom uniforms change? Should it really just be something like this?
|
We improved metrics collection in v7, perhaps it introduced a bug with logging. |
Yes but I would start by making sure it works without using binary data. As long as you are not changing the data array every render, using binary data should just optimize initialization time, not animation time.
});``` Should that be |
Everything works, even with binary, I'm just trying to get the performance gains I was expecting.
Hmm, but I moved my filtering to the shader specifically so I could animate (show/hide) large numbers of points without touching the CPU and incurring lag. Is it reasonable to expect deck to support that in a performant manner with 1M+ points? More? |
On our MacBook pros we usually see rendering performance start to fall somewhere between 1-10M points. 1M is usually very good. We have examples on our website that loads close to 1M points (e.g. the scatterplot example) and perform quite well, if they perform well for when dragging and tilting then things should work. Your Since the code you showed me using binary presumably doesn't work (you said the submitting the binary positions didn't work for you) I suspected that you were actually using some other code and that code triggers some deck.gl update. |
@bclinkinbeard A few ideas:
new CustomScatterplotLayer({
data: {length: this.eventsTable.count()}, // a new object is created
...
})
new CustomScatterplotLayer({
instancePositions: <Float32Array>,
instanceTime: <Uint32Array>,
...
}); |
Thanks, I am using the 7.0.6 bundle. I switched the data prop to a stable ref with I do think it's possible some extra calls are happening so I'm going to investigate that. |
Ah that is probably from the instancePositions64xyLow calculation: https://github.com/uber/deck.gl/blob/master/modules/layers/src/scatterplot-layer/scatterplot-layer.js#L179 Just to verify, try construct an empty |
That worked, thanks! My layer definition now looks like this.
However, that generates a warning of |
The warning should be non-blocking. What is the size of your |
Cool, went ahead and made it a
It varies, but just now the first render was 600K, the second 1.2M |
Are you packing [x, y] instead of [x, y, z]? |
No, I just have similarly sized data chunks that I'm loading in succession. If I log out the lengths while rendering one particular dataset I get the following output.
If I then load another dataset of roughly the same size the counts change as I would expect and I see this output.
Immediately after that, though, I see the |
This may be caused by picking colors. Can you create a new data object whenever |
That fixed it, thank you!! I will close this issue once I do a bit more verification. 🚀 🎉 |
The reason we don't document this approach is, as you have seen, there are a lot of implicit expectations for externally provided attributes, and coordinating their change with internal attribute updates can get tricky. We work with arrow data internally too and we are working on new API designs that make it easier. |
Awesome, I poked around in the 7.x binary RFC docs a bit. Are there issues or branches I should watch for early access to the new APIs? We are just getting started with Arrow but I expect we'll be using it extensively in the near future. Thanks again! |
I've got a Scatterplot that hides items in response to a time scrubber, which I've implemented by returning 0 from
getRadius
for items outside the active time range.getRadius
is specified inupdateTriggers
as well, but I'm wondering if this is the most performant way to do this.Would setting the alpha to 0 or filtering the items out of the data ahead of time be a better approach? I'm also curious if smoothly scrubbing through 1M+ points is a realistic goal or not. I've rendered up to about 7M points but things get pretty bogged down.
The text was updated successfully, but these errors were encountered: