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

LensFlare: initialize OGRE compositors during plugin initialization #2764

Merged
merged 3 commits into from
Jun 27, 2020

Conversation

scpeters
Copy link
Member

There are several SensorPlugins that create Ogre compositors (such as LensFlareSensorPlugin). It was reported by @mogumbo that the order in which compositors are applied affects the rendered output, but the LensFlareSensorPlugin always seems to be applied last, regardless of the order in which plugins are specified in an SDFormat file. @iche033 suggested moving the code for initializing a gazebo::rendering::LensFlare compositor from LensFlare::Update to Lensflare::SetCamera, so that the compositor would be added during plugin initialization.

The initialization code expects a pointer to a DirectionalLight, which is not available until the first render update. It seems to work to initialize with a nullptr for the DirectionalLight since the light ptr is being set every update. I also added logic to exit notifyMaterialRender early if the light pointer is nullptr.

Initialize OGRE compositors in SetCamera() instead of Update()
so the compositor order can be better controlled.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters requested a review from iche033 June 25, 2020 00:30
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. Just very minor comments

@@ -97,6 +97,12 @@ namespace gazebo
Ogre::Vector3(static_cast<double>(this->camera->ViewportWidth()),
static_cast<double>(this->camera->ViewportHeight()), 1.0));

if (!this->light)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should be able move this check to the top of the function as we don't need to set the params anymore

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this->dataPtr->lensFlareInstance->addListener(
this->dataPtr->lensFlareCompositorListener.get());
}
else
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove brackets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
@scpeters scpeters merged commit 378310a into gazebosim:gazebo9 Jun 27, 2020
@scpeters scpeters deleted the lens_flare_init_compositor_9 branch June 27, 2020 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants