-
Notifications
You must be signed in to change notification settings - Fork 486
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
Workaround for wrong distortion material applied to some cameras #3136
Workaround for wrong distortion material applied to some cameras #3136
Conversation
gazebo/rendering/Distortion.cc
Outdated
// to this active material. | ||
_material->getTechnique(0)->getPass(_passId)->getTextureUnitState(1)-> | ||
setTexture(distortionTexture); | ||
|
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.
nit: I believe there is trailing whitespace on this line
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.
fixed
this fixes the issues I'm seeing in the VIPER simulation. I've even tried reverting the fixes from #3033 and #3060 with the following patch and everything still seems to work
|
this appears to be a more complete fix for #2527 |
The new title "Fix Camera Distortion initialization: use correct material" is a bit misleading. My workaround actually leaves the incorrect material in place but updates its distortion texture each time a different camera renders. |
thanks; I've restored your original title |
ok yeah it does look like the compositor instances share the same compositor technique inside ogre. Changes look good to me. |
homebrew CI is failing due to gazebo-tooling/release-tools#573, but otherwise the CI results look fine to me |
rerunning macOS CI |
When using stereo cameras with different distortion parameters and attaching other Ogre compositors to the cameras, the same distortion parameters will be applied to both cameras. This PR implements a workaround.
It looks to me like Distortion.cc tries to do the right thing by using a unique Ogre::CompositorInstance for each camera. Unfortunately, it looks like these CompositorInstances share the same CompositionTechnique inside Ogre, causing passes and materials to get stomped from one CompositorInstance to the next. This stomping only happens if you add compositors to your cameras in addition to the distortion compositor.