Skip to content

Conversation

@thomassedlmayer
Copy link
Contributor

This PR tackles a livelock issue that appears when the same ModelPrimitive is passed in multiple consecutive frames again and again. When the render performance is already bad, models are never actually rendered until freeing the load by pausing the playback.

What seems to happen is that the asynchronous loading of models aborts before updating the renderable list when there was received a more recent frame in the meantime. This makes sense because the renderable list of the next frame shouldn't be updated in that case. But before aborting, it performs the actual loading of the model which is then just discarded. In our use case this leads to an even worse render performance and certain models are never being shown even though they actually stay "static" (same data, same position etc.) once they appear. Once they are loaded, the model cache works and the model is reused from then on. But if it's never loaded, it is never being displayed and in every single frame it loads it but then discards it.

So I added some kind of "pending loaded model cache" which stores a loaded model for the case that it might be needed in the succeeding frame. If the rate of incoming frames is very high, there will still be some redundant tries of loading the model but at least it ends once one process has finished loading.

There are also some other slight changes in the updateModels function which only tackle readability. I thought, it might be easier to understand the code if we rename renderable to reusedRenderable as it is only assigned if it can be reused.

I append an example mcap which can be viewed using the asam-osi-converter. The issue should appear even on better hardware when increasing the playback speed. On my laptop it starts to show on 2x speed. It starts to slow down more and more and never comes back to normal speed until pausing the playback.

many_traffic_lights.zip

Signed-off-by: Thomas Sedlmayer <[email protected]>
Signed-off-by: Thomas Sedlmayer <[email protected]>
@thomassedlmayer thomassedlmayer force-pushed the feature/pending-model-load-cache branch from 3a6f478 to d75225c Compare December 18, 2025 13:02
@jdsika
Copy link
Contributor

jdsika commented Dec 18, 2025

@luluiz this is an important fix for the Simulation departmemt.

@ctw-joao-luis
Copy link
Contributor

Hey @thomassedlmayer I've tried to use the .mcap you left to test this change but it isn't rendering anything to me. I toggled "/PMSF.SensorView" visibility, but nothing renders, is it supposed to be this way?

Even so I tested your PR with the .mcap you provided and saw a small performance improvement

@jdsika
Copy link
Contributor

jdsika commented Dec 23, 2025

Did you install the plugin? https://github.com/lichtblick-suite/asam-osi-converter

@ctw-joao-luis
Copy link
Contributor

Did you install the plugin? https://github.com/lichtblick-suite/asam-osi-converter

Yes, I have it installed

@thomassedlmayer
Copy link
Contributor Author

@ctw-joao-luis Do you see something when you open the file without the changes of this PR (e.g. latest lichtblick release)? You should see this road starting at (0,0) expanding towards positive x:

image

Did you try to uninstall the extension and install it again, then do a reload? I noticed that sometimes there are issues when installing an extension over an already installed version.

Did you use the latest asam-osi-converter version? Does it show any available frame transforms? Does it show any data in the raw panel?

Otherwise, I don't have any clue why this doesn't render properly for you. I tested the file on different OS's and machines and it works for me every time without issues.

@ctw-joao-luis
Copy link
Contributor

@ctw-joao-luis Do you see something when you open the file without the changes of this PR (e.g. latest lichtblick release)? You should see this road starting at (0,0) expanding towards positive x:
image

Did you try to uninstall the extension and install it again, then do a reload? I noticed that sometimes there are issues when installing an extension over an already installed version.

Did you use the latest asam-osi-converter version? Does it show any available frame transforms? Does it show any data in the raw panel?

Otherwise, I don't have any clue why this doesn't render properly for you. I tested the file on different OS's and machines and it works for me every time without issues.

So I was able to make it work, I had 2 different version of the ASAM OSI extension installed and I think that was where the problem was coming from. And yeah with that mcap the performance increase, especially not decreasing overtime, is tremendous. Good job!

Copy link
Contributor

@ctw-joao-luis ctw-joao-luis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@ctw-joao-luis ctw-joao-luis merged commit 1dfe923 into lichtblick-suite:develop Jan 7, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants