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

Fix crash on material switcher when there are points #586

Closed
wants to merge 3 commits into from

Conversation

chapulina
Copy link
Contributor

🦟 Bug fix

Summary

Since #578, simulations where we use point markers are crashing when the user clicks on the scene. I traced it back to a null pointer access. This fixes the issue for me, but I don't know if there are unintended consequences.

CC @darksylinc

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • 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.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

@chapulina chapulina added bug Something isn't working MBARI-LRAUV Sponsored by MBARI-LRAUV project: https://github.com/osrf/lrauv labels Mar 16, 2022
@chapulina chapulina requested a review from iche033 as a code owner March 16, 2022 18:30
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Mar 16, 2022
@darksylinc
Copy link
Contributor

Hi!

Your fix should revert code to the old behavior thus any "unintended consequence" is basically just the same as before my PR.

What I would be interested is in knowing how to repro, to identify & understand why it is happening in the first place.

@codecov
Copy link

codecov bot commented Mar 16, 2022

Codecov Report

Merging #586 (3c94f9d) into main (f3c4003) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #586   +/-   ##
=======================================
  Coverage   53.54%   53.55%           
=======================================
  Files         214      214           
  Lines       21304    21304           
=======================================
+ Hits        11408    11409    +1     
+ Misses       9896     9895    -1     
Impacted Files Coverage Δ
ogre2/src/Ogre2MaterialSwitcher.cc 79.41% <100.00%> (ø)
...e/ignition/rendering/base/BaseGaussianNoisePass.hh 100.00% <0.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3c4003...3c94f9d. Read the comment docs.

@iche033
Copy link
Contributor

iche033 commented Mar 16, 2022

I think I was able to reproduce this in the camera integration test. I updated the ShaderSelection test to include a LidarVisual which uses point rendering and it crashes with backtrace pointing to that line. Here is the test:
https://github.com/ignitionrobotics/ign-rendering/blob/lowLevelMat_points/test/integration/camera.cc

The shader used for point rendering is this one here:
https://github.com/ignitionrobotics/ign-rendering/blob/lowLevelMat_points/ogre2/src/media/materials/programs/GLSL/point_vs.glsl

@chapulina
Copy link
Contributor Author

Your fix should revert code to the old behavior thus any "unintended consequence" is basically just the same as before my PR.

I don't understand why that would be the case. All this PR checks is for a null pointer access. My guess is that we're trying to get the material for the points but there's none.

If one thing, I think this PR means that points aren't handled properly on sensor passes, but it shouldn't affect any other items which do have materials. So the current choice is either not to handle points well on sensors, or a crash. I'd like to get this PR in ASAP to fix the crash.


Thanks for the reproduction steps, @iche033 .

@iche033
Copy link
Contributor

iche033 commented Mar 22, 2022

The problem is that the point cloud low level material is manually created here https://github.com/ignitionrobotics/ign-rendering/blob/ign-rendering6/ogre2/src/Ogre2LidarVisual.cc#L171 and so does not have a _solid version. The resulting behavior is that it will be rendered incorrectly in the selection buffer camera used for mouse picking and also other camera sensors. In the ign-gazebo's use case, the sensors should not see point cloud rendering so it should be fine. If mouse picking starts acting wierd especially with 3d lidar points that fill the whole scene, we will probably need to set visibility masks / flags so that the selection camera does not see the points.

I'll get this PR in first to fix the crash.

@iche033
Copy link
Contributor

iche033 commented Mar 22, 2022

oh just saw #593. I'll take a look at that PR

@chapulina
Copy link
Contributor Author

Superseded by #593

@chapulina chapulina closed this Mar 22, 2022
@chapulina chapulina deleted the chapulina/7/switcher_crash branch March 22, 2022 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🌱 garden Ignition Garden MBARI-LRAUV Sponsored by MBARI-LRAUV project: https://github.com/osrf/lrauv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants