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

Incorrect wide angle camera lens flare occlusion after camera movement #3310

Closed
mogumbo opened this issue Mar 29, 2023 · 2 comments · Fixed by #3325
Closed

Incorrect wide angle camera lens flare occlusion after camera movement #3310

mogumbo opened this issue Mar 29, 2023 · 2 comments · Fixed by #3325
Labels
bug Something isn't working

Comments

@mogumbo
Copy link
Contributor

mogumbo commented Mar 29, 2023

Environment

Description

  • Expected behavior: After moving a robot with a wide angle camera and then triggering an image, lens flare should be occluded or not occluded as expected.
  • Actual behavior: Sometimes lens flare is not occluded by objects, and sometimes lens flare does not appear when there is no object to occlude it.

Steps to reproduce

After moving your robot this call to occlusionScale will sometimes give an incorrect result: https://github.com/gazebosim/gazebo-classic/blob/gazebo11/gazebo/rendering/LensFlare.cc#L314

If you inspect the view matrix just before that call to occlusionScale, it will not be up to date. Move your robot, trigger an image, and then trigger a second image. You should see that the view matrix changes between image triggers. Here's some code for inspecting the view matrix:

            const Ogre::Matrix4& m = this->dataPtr->wideAngleDummyCamera->OgreCamera()->getViewMatrix();
            std::cerr << m[0][0] << "  " << m[0][1] << "  " << m[0][2] << "  " << m[0][3] << std::endl;
            std::cerr << m[1][0] << "  " << m[1][1] << "  " << m[1][2] << "  " << m[1][3] << std::endl;
            std::cerr << m[2][0] << "  " << m[2][1] << "  " << m[2][2] << "  " << m[2][3] << std::endl;
            std::cerr << m[3][0] << "  " << m[3][1] << "  " << m[3][2] << "  " << m[3][3] << std::endl;

Digging a little deeper, you can see that in Scene::FirstContact https://github.com/gazebosim/gazebo-classic/blob/gazebo11/gazebo/rendering/Scene.cc#L1217 the origin and dir used to compute occlusions are incorrect during the first image trigger because the view matrix is incorrect.

Output

@mogumbo mogumbo added the bug Something isn't working label Mar 29, 2023
scpeters added a commit that referenced this issue Mar 30, 2023
This adds a model with wide-angle cameras updated at 1 Hz
that demonstrate the bug reported in #3310 when moved
back and forth.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters
Copy link
Member

I added an additional model with a pair of wide-angle cameras updated at 1 Hz to a test world in a43e4a3 and was able to reproduce the issue:

wide-angle-lens-flare-occlusion-lag-720.mov

@scpeters
Copy link
Member

there is a fix in review in #3325

scpeters added a commit that referenced this issue May 25, 2023
* Force update of wide angle dummy camera

Signed-off-by: Audrow Nash <audrow@intrinsic.ai>

* Add test using cameras with slow update rate

The test adds a model with wide-angle cameras updated at 1 Hz
that demonstrate the bug reported in #3310 when moved
back and forth. The lag effect is tested by loading with
--lockstep and the cameras initially occluded, moving
the cameras to an unoccluded pose while paused, and then
confirming that the next image correctly has lens flare.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Co-authored-by: Steve Peters <scpeters@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants