gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.2k stars 484 forks source link

Fixing WideAngleCamera Lensflare issue #3276

Closed sanjuksha closed 1 year ago

sanjuksha commented 2 years ago

Signed-off-by: Sanjuksha Nirgude sanjuksha@gmail.com

🦟 Bug fix

https://github.com/gazebosim/gazebo-classic/issues/3273

Summary

Porting the same change for gazebo classic from https://github.com/gazebosim/gz-rendering/pull/746 and a fix for wide angle camera not showing lensflare at certain angles. Wide Angle camera used to loop through all cameras to find the occlusion scale which resulted into not rendering lensfalre at certain angles. The fix removes the looping through all cameras and uses the camera facing the light source to calculate occlusion.

Checklist

Results

Screenshot from 2022-11-15 16-55-46

sanjuksha commented 2 years ago

Added one more change for Z check based on this comment https://github.com/gazebosim/gazebo-classic/issues/3273#issuecomment-1307742254

scpeters commented 2 years ago

cc @kjeppesen1 @mogumbo

kjeppesen1 commented 2 years ago

This fix works for me :+1: I moved around a pair of wideangle cameras at various angles and positions in a world with a DEM, and I no longer see the lens flare disappearing when it isn't supposed to.

scpeters commented 2 years ago

I've restarted the windows build

scpeters commented 1 year ago

I cleaned up some of the code changes in https://github.com/gazebosim/gazebo-classic/pull/3276/commits/5740ce52dc46363404be7d46f7fe986afe8d536b and https://github.com/gazebosim/gazebo-classic/pull/3276/commits/adf7d1f4b289af91b40e85240aa13e3b3671de6f and then made an adjustment to the new test in https://github.com/gazebosim/gazebo-classic/pull/3276/commits/c63047ca96959343f094a7c9ec012f150801f7ef to make it easier to confirm the presence of the bug without the fix in this branch

scpeters commented 1 year ago

Thanks to some debugging help from @iche033, I added some additional cameras in https://github.com/gazebosim/gazebo-classic/pull/3276/commits/d33593d662e0c62cd85b1f2cb6abfeadba73877f and https://github.com/gazebosim/gazebo-classic/pull/3276/commits/c92f948e4116768ba788ba0bc79e1e4d2f5f6de4 to illustrate some problems with the occlusion checking in the test world added in this pull request

gazebo --verbose worlds/lensflare_wideangle_cam.world

Failure to occlude in wide_angle_cameras_occluded_high camera image

There is a box directly in front of the camera, so it should occlude but doesn't

Screen Shot 2023-01-31 at 3 26 07 PM

Occluding when it shouldn't in wide_angle_cameras_occluded_higher camera image

There is a box to the right of the camera (partially visible), but it should not be occluding, but the lens flare is not there

Screen Shot 2023-01-31 at 3 26 20 PM

It seems to be checking for occlusions in the wrong direction?