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

Improve Ogre2GpuRays performance #955

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Improve Ogre2GpuRays performance #955

merged 2 commits into from
Jan 17, 2024

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Jan 13, 2024

🦟 Bug fix

Summary

Tuned Ogre2GpusRays' (lidar) ogre2 compositor to bypass computationally expensive phases involving lights. Since we are just generating depth data, we do not need to care about the lights in the scene so we can skip these computations.

The compositor parameter description can be found in this ogre doc.

  • enable_forwardplus - affects performance when there are many lights in the scene. However we only care about depth data for lidars (and not the rgb color images that are affected by lights) so set this to be disabled. Specifically, a big chunk of time was found to be spent in ogre scene manager's _cullPhase01 function. Disabling this flag gave the most perf boost.
    • Note the ogre doc lists enable_plus which is a typo.
  • light_visibility_mask - tells ogre that we don't want to see any lights

I used this lidar_profile.sdf world for profiling. It consists of a single lidar with 160 degrees FOV and 640 samples.

  • Note: To simulate this lidar, internally Ogre2GpuRays uses 3 environment cameras for collecting depth data - the number of env cameras is important as it directly affects to total render time. If a lidar has a smaller FOV (<90), only 1 env camera is needed and the update time would be close to ~1/3 of the time shown below.

Here're before and after plots of time taken to do a Render operation
lidar_profile

The time taken is now roughly 2-4ms for each render update. The performance is still behind ogre 1.x in which the render operation for the same lidar takes ~1ms

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@github-actions github-actions bot added the 🎵 harmonic Gazebo Harmonic label Jan 13, 2024
Copy link

codecov bot commented Jan 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (eeaf6e8) 75.54% compared to head (3e65518) 75.54%.

Additional details and impacted files
@@                Coverage Diff                @@
##           gz-rendering8     #955      +/-   ##
=================================================
- Coverage          75.54%   75.54%   -0.01%     
=================================================
  Files                177      177              
  Lines              16888    16889       +1     
=================================================
  Hits               12758    12758              
- Misses              4130     4131       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ahcorde
Copy link
Contributor

ahcorde commented Jan 15, 2024

@iche033 can we backport this to fortress ?

@iche033
Copy link
Contributor Author

iche033 commented Jan 16, 2024

@iche033 can we backport this to fortress ?

yep I'll do that

@iche033 iche033 merged commit c62f6e9 into gz-rendering8 Jan 17, 2024
11 of 14 checks passed
@iche033 iche033 deleted the lidar_perf_ogre2 branch January 17, 2024 01:45
iche033 added a commit to azeey/gz-rendering that referenced this pull request Jan 18, 2024
* improve ogre2 gpu rays perf

---------

Signed-off-by: Ian Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants