Skip to content
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

Viewer auto suspend rendering when scene is idle #15864

Merged
merged 39 commits into from
Jan 30, 2025

Conversation

ryantrem
Copy link
Member

@ryantrem ryantrem commented Nov 21, 2024

This PR adds support for suspending rendering when the scene is idle (e.g. nothing is changing from frame to frame, and the same exact pixels would be rendered repeatedly). The idea is to reduce resource pressure and not destroy the battery on a mobile device.

I have two problems remaining for this PR:

  1. Sometimes (it's hard to repro) I can get into a state where the camera position jumps back and forth between two very close positions (like the y value of the position has a difference of .000000000001). This makes _isSynchronizedProjectionMatrix return true every frame. I don't think this has anything to do with my PR, I think this is a pre-existing bug that we just don't notice. Since it is hard to repro, I haven't been able to figure out what causes it yet.
  2. Very rarely I get an error related to WebGPU snapshot rendering mode where it thinks the gpu bundle is out of date, and then nothing renders (so rare, but catastrophic). I don't know why this happens, but I'm guessing some kind of timing issue.

Edit: After merging master, I'm no longer able to repro the first of the above issues. I can still repro the second issue, especially with complex models.
Edit: After bringing in fixes from @Popov72, the first issue appears to be fixed.

@ryantrem ryantrem requested a review from Popov72 November 21, 2024 00:27
@bjsplat
Copy link
Collaborator

bjsplat commented Nov 21, 2024

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 21, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 21, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 21, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 21, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented Nov 21, 2024

@ryantrem
Copy link
Member Author

I plan to come back to this, hopefully soon. I was waiting on some fixes from Alexis which he recently was able to complete.

@j-te
Copy link
Contributor

j-te commented Jan 20, 2025

Potential repro on point 2: errors on window resize. Chrome 131.0.6778.266 https://codepen.io/j-te/pen/pvzOgqx.

from: https://forum.babylonjs.com/t/viewer-v2-render-considerations/56024/4?u=j-te

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@ryantrem ryantrem marked this pull request as ready for review January 29, 2025 21:32
@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 29, 2025

@ryantrem ryantrem merged commit 59c83cc into BabylonJS:master Jan 30, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants