-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Sets bCapture* true only while showing subwindow #4147
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
Conversation
Sets bAlwaysPersistRenderingState to true. This fixes bugs of capture Sets bCaptureOnMovement and bCaptureEveryFrame to true only when they are going to be viewed on as subwindow
rajat2004
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to test, but any idea why the performance for simGetImages dropped?
| else { | ||
| gameViewport->bDisableWorldRendering = 0; | ||
| } | ||
| gameViewport->bDisableWorldRendering = (uint32)mode_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just use the nodisplay variable instead of casting mode_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, I was removing the branch assignation and used the wrong variable, will issue a commit to address this, thanks.
| } | ||
|
|
||
| onViewModeChanged(false); | ||
| onViewModeChanged(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the beginning, we set all cameras to NoDisplay mode to improve performance?
Would be great if you could add some comments in the code also as to why this helps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We initialize all cameras with bCaptureOnMovement and bCaptureEveryFrame to false.
This improves performance because the capture components are no longer updating every frame and only update while requesting an image (and are set to true while we are showing them on a sub-window because sub-window captures don’t count as a request)
Sorry I don’t quite get the question, if you mean why is performance still drops while simGetImages is called: it’s because we still need to acquire the images (this is what causes the performance drop) this will commit will only drop while there is a request for the camera instead of having all of them updating every frame |
Fixed gameViewport->bDisableWorldRendering assignation Added comments explaining the reasons behind setting cameras to nodisplay
|
Ah, I think I misunderstood the issue, I thought the FPS of |
|
Thanks for submitting this fix @nznaza! Tested this locally using the repro steps for #1724 and #2967. Confirmed #1724 and #3504 (which is a duplicate of #1724) are fixed now. Unfortunately, I was still able to repro #2967 and I didn't see any significant performance change using the image_benchmarker.py script (I was getting around 40 fps for the Blocks map both with and without this fix), so I suspect #3070 still repros. Considering this does fix some of the issues, I'm going to go ahead and merge this, we can address the other issues in a separate PR. |
Sets bAlwaysPersistRenderingState to true. This fixes bugs related to capture while on NoDisplay.
Sets bCaptureOnMovement and bCaptureEveryFrame to true only when they are going to be viewed on a subwindow
Fixes: #1724
Fixes: #2967
Fixes: #3504
Fixes: #3070
Partially fixes #4112
Should fix most of the FPS while capturing problems.
About
This PR fixes the NoDisplay/Headless bug by setting bAlwaysPersistRenderingState to true.
Setting bCaptureOnMovement and bCaptureEveryFrame to true only while it's on an active subwindow camera improves the performance of image capture/recording and python simGetImages
How Has This Been Tested?
A python script was used to display the captured images to corroborate the accurate capture of the desired captures; the same script was used for all captures using ComputerVision.
Performance goes back up after stopping capture while on NoDisplay, but stays the same after recording or using the python simGetImages, but this can be fixed by displaying and hiding a subwindow.
settings.json
Screenshots (if appropriate)
NoDisplay
RGB

Previous:
Depth:

Previous:
After:

Segmentation

Previous:
After:

Performance captures
Recording previous to fix

After recording and showing and hiding subwindow (small gain)

Recording after fix (Lower timings, )

After recording and showing and hiding subwindow (Back to normal)

Python capture before fix

Python capture post fix

Python capture before fix (Only front_center)

Python capture after fix (Only front_center)

Python capture before fix (Only front_center Scene)

Python capture after fix (Only front_center Scene)

While capturing with python's simGetImages the performance after the fix are lower, but measurable: 205 ms vs 185ms, 70ms vs 54, single images are within margin error, but fix is still lower
For comparison here are the timings of all cameras and NoDIsplay
While capturing

After stopping capturing, the levels go back to normal without needing to enable a subwindow.
