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 depth camera breaking shadows #2907

Merged
merged 3 commits into from
Apr 17, 2021

Conversation

Benlitz
Copy link
Contributor

@Benlitz Benlitz commented Dec 15, 2020

In the code of the depth camera, setShadowTechnique(Ogre::SHADOWTYPE_NONE); is applied to disable shadows. However this is not the correct way to do it. This function disables shadow globally, destroying shadow maps (at least until the next frame, even if shadows are restored with this function), and is not meant as a way to quickly toggle on/off shadows. The documentation of Ogre states:

you should call this method at the start of the scene setup.

This is the cause of issue #2584. Basically, any camera that tries to render after a depth camera in the same frame won't have any shadow.

This is fixed this by removing the calls to setShadowTechnique. Instead, shadows are disabled on the viewport object. I did observe that this fixes the issue mentioned above in the project I'm working on.

… this is not necessary and breaks lighting for all other cameras that will render after it in the same frame
@iche033
Copy link
Contributor

iche033 commented Dec 19, 2020

@osrf-jenkins run tests please

@iche033
Copy link
Contributor

iche033 commented Dec 19, 2020

Triggered another round CI. Local testing confirmed that the changes fix the issue for me.

@scpeters scpeters merged commit 31dbbcc into gazebosim:gazebo9 Apr 17, 2021
@scpeters
Copy link
Member

thanks for the fix!

scpeters added a commit to scpeters/gazebo that referenced this pull request Apr 19, 2021
* Remove modifications to the shadow technique done in the
DepthCamera, this is not necessary and breaks lighting for all
other cameras that will render after it in the same frame

* Add call to setShadowsEnabled for the normals viewport as well

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
scpeters added a commit that referenced this pull request Apr 20, 2021
* Remove modifications to the shadow technique done in the
DepthCamera, this is not necessary and breaks lighting for all
other cameras that will render after it in the same frame

* Add call to setShadowsEnabled for the normals viewport as well

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants