Hi I have an application that allows the users to navigate through discrete slices of a 3D model. They can to customize what they want to see.
Each row contains 2 different slices of results of a CFD solve and a delta between the two. To show this I use viewports each viewport contains 1 renderer and 1 actor.
The frame rate when it’s just one row is good. But when I have 3 rows i.e. 9 viewports the frame rate is appalling. Is this expected?
The code that I use to update my render window is this:
async def change_slice(self, slice_number: int, event: str):
# my code which takes negligent time
await self.orchestrator.change_slice(slice_number, event)
# vtk update which takes a long time
vtkView = self.getView("-1")
I am unaware of a different way of updating the view and I would welcome ways of making my code more performant.
The call to
self.getApplication().InvokeEvent("UpdateEvent") will push all views. So more views, slower it will get.
Can you only update a single view, or do you need to update them all?
If you can pick a subset, you should try to call this method using its annotation to call it…
Otherwise, you should switch the view to interactive (so you can have better interactivity) and then once done move back to a still render call.
How can I call it from another vtk web protocol?
What do you mean by using its annotation?
Thank you very much for helping me.
Just to add more info, the idea is to update all views (it’s still just 1 render window but with 9 viewports). I have tried to make the view interactive but I could only do it from the frontend is that the way to go? I also tried to call “viewport.image.push” from the frontend but it wasn’t fast enough still.
This also renders really really quickly on desktop only it’s just when using web that it gets slow so I don’t understand that.
This is what I meant by calling using its annotation.
But if you say that you need all the views, then what you are doing seems reasonable.
Regarding the speed on the web vs desktop, it mainly depend on how much pixels you need to encode/send/decode… While on the desktop, the texture can directly be pasted to the screen with no overhead.
Since you are using a single RenderWindow on the client side, the only difference between 1 row and 2 is the size of the window? Or do you keep the same window size? (Sorry I’m trying to guess what could be the cause of slowness.)
I will use the annotation to check if it’s quicker.
About the image: it’s the same size and same amount of pixels that’s what I don’t understand. The images sometimes are a little bit bigger due to having more colour but I don’t think that’s the main issue (image size I mean).
The thing is we can see 60fps on desktop (maybe more we don’t see any frames failing) but we can’t even reach 12fps on web. It seems too big of a downgrade.
That seems indeed strange and should not be that bad. I’m wondering if something is triggering more Render on the server than require. Are you turning off the interactor render calls?
I wasn’t but it seems like it didn’t improve performance much doing so.
Are there any more of those performance checks that I should check?
A couple of questions:
Do you do off screen rendering?
Is it worth trying to convert polydata or the render window to image myself and handle streaming?
Is there some kind of example to do that?
Would serializing + streaming a RW be faster?
These are just to guide further development thank you!