-
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
Generate spot light shadow maps #2914
Conversation
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
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.
I haven't tested it yet, but I made a few small comments and noticed from CI some failures in RenderingLight_TEST
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.
noticed from CI some failures in RenderingLight_TEST
I believe this failing test expectation for spot lights should be reversed, but there's also a failing expectation for point lights and I'm not sure what that value should be, if shadows aren't yet working for point lights.
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
should be fixed. 7aa1d35. |
yep, the test is passing now 👍 |
the spotlight shadows are working on Ubuntu, though they don't seem to be working on macOS. I do see a light grey artifact that changes orientation as I rotate the camera, but not the nice shadows generated on Ubuntu I tried adding an extra spotlight just for fun in Ubuntu, and I didn't notice an extra dark area where it was shaded by both spot lights. the shadow darkness seems to be uniform color; maybe that is expected, I don't know |
gazebo/rendering/RTShaderSystem.cc
Outdated
{ | ||
return; | ||
} | ||
|
||
for (const auto &scene : this->dataPtr->scenes) | ||
std::lock_guard<std::mutex> lock(this->dataPtr->updateMutex); |
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: if we want to minimize the time spent in this lock, we could only lock it while copying the values of this->dataPtr->updateShadows
and this->dataPtr->updateShaders
, then reset both to false
, and then release the mutex
for example:
bool updateShaders, updateShadows;
{
std::lock_guard<std::mutex> lock(this->dataPtr->updateMutex);
updateShaders = this->dataPtr->updateShaders;
updateShadows = this->dataPtr->updateShadows;
this->dataPtr->updateShaders = false;
this->dataPtr->updateShadows = false;
}
then read from the local variable instead of the member variable
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.
yep done. 5f426b2
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Signed-off-by: Ian Chen <ichen@osrfoundation.org>
I am guessing it could be related to the glsl version used. I remember we had issue with glsl 130 on macOS so I downgraded to version 120 in cf404b1. Let me know if this makes any difference.
yes that's expected. I wrote a very simple shader for the demo that just sets the color to a fixed value if it's a shadowed region. It's mainly for demo purposes and the goal is to show that you can access the shadow map texture. |
looks good to me; I'll approve once the CI finishes assuming there are no related regressions |
Updated gazebo to generate shadow maps for spot lights. This does not mean the spot lights will now start casting shadows in gazebo - we still need to update the RTShaderSystem code to actually render them. This does however mean that the shadow maps are now available and we can access them through custom material shaders. The spotlight_shadow_demo.world contains a shadow receiver ground plane with custom material shaders to show how to access the shadow texture generated by OGRE. Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Updated gazebo to generate shadow maps for spot lights. This does not mean the spot lights will now start casting shadows in gazebo - we still need to update the RTShaderSystem code to actually render them. This does however mean that the shadow maps are now available and we can access them through custom material shaders. The spotlight_shadow_demo.world contains a shadow receiver ground plane with custom material shaders to show how to access the shadow texture generated by OGRE. Signed-off-by: Ian Chen <ichen@osrfoundation.org>
Updated gazebo to generate shadow maps for spot lights. This does not mean the spot lights will now start casting shadows in gazebo - we still need to update the RTShaderSystem code to actually render them. This does however mean that the shadow maps are now available and we can access them through custom material shaders.
I added a
spotlight_shadow_demo.world
that contains a shadow receiver ground plane with custom material shaders to show how to access the shadow texture generated by OGRE.