-
Notifications
You must be signed in to change notification settings - Fork 68
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
drawing of colorbar in vcs too slow #849
Comments
@dlonie let me know if that's not clear |
@dlonie also let's use the same branch for this, I'm using: https://github.com/UV-CDAT/uvcdat/tree/optimize_vtk |
I'll take a look soon. |
You're on the right track. Adding a vtkScalarBarActor that uses the same vtkLookupTable as the data mapper should be sufficient. Let me know how I can help. |
@dlonie no the vtkscalarbaractor won't work. I tried it. If I remember correctly you can't control very well the viewport (i.e dims) and you can't control the text on it. You can't add extension arrows. Also we need to be able to control the text fonts color height etc... that is why I assigned it to kit ware because it will need a serious overall of the scalarbaractor. |
Ah, you want a different style. It's probably best to write a new one from scratch if you need that level of control over the elements. If we go this route, can you provide a list of the specific features/customizations you need? Alternatively, have you profiled the current scalar bar drawing code? If we can figure out what's making it take so long, we might be able to optimize it and keep the existing look and feel without too much effort. |
yes there's many places where the current code can be optimized. python loops over the 255 colors is bad while creating the fillarea object, then while processing the fillarea object we go thru that loop again. We already have the lookupup table in VTKPlot.py so I think using ScalarBarActor (a new one) is the way to go. There's not so much more that needs to be added, I almost think the current one is close form functional for us. A short sumary of what our colorbar actor would need |
Rather than allocating (and rendering!) a unique polydata + mapper + actor combo for each vertical slice of the color bar, create a single, multicell polydata that gets rendered at once in a single actor/mapper. This speeds up the execution of prepFillArea using the test script in #849 from 0.25s to 0.09s on my machine.
See the branch I just pushed. I profiled the existing implementation and found some quick optimizations. Allocating and rendering separate polydata, mappers, and actors for each vertical slice of the colorbar eats up a lot of time (you really want to try to minimize the number of actors in VTK for best performance), and the data fits quite well into a single multicell polydata. This is roughly 3x faster on my machine and produces the same results. Would this improve performance enough for you folks? IMO, if we can avoid spending a week or two developing a new C++ scalar bar, we should ;-) |
will test. If works much better for me will merge then into master. If @williams13 still wants more performance improvement later we can revisit. Does that sounds right? |
Sounds good to me, let's see what Dean thinks. |
I am rebuilding it now… Back in a few. Best regards, From: David Lonie <notifications@github.commailto:notifications@github.com> Sounds good to me, let's see what Dean thinks. — |
Can we close this, or is more work needed? |
Charles was looking at this. I believe the drawing of the color bar on the plot has been correct and sped up. -Dean From: David Lonie <notifications@github.commailto:notifications@github.com> Can we close this, or is more work needed? — |
Yes @dlonie code is in. Closing |
the following code, takes around .5sec just to draw the colorbar.
The code to draw the colorbar should be rewritten in pure VTK.
current code:
https://github.com/UV-CDAT/uvcdat/blob/master/Packages/vcs/Lib/template.py#L1369
in the vtkbackend we call it at:
https://github.com/UV-CDAT/uvcdat/blob/master/Packages/vcs/Lib/VTKPlots.py#L1127
I think we should update
vtkScalarBarActor
The text was updated successfully, but these errors were encountered: