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

Changed calculation for range clipping #325

Merged
merged 9 commits into from
Aug 3, 2021
Merged

Conversation

Lobotuerk
Copy link
Contributor

Signed-off-by: Tomas Lorente [email protected]

🦟 Bug fix

Fixes osrf/subt#342

Summary

This changes clipping to be based on distance to the focal point instead of distance to the focal plane.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

Signed-off-by: Tomas Lorente <[email protected]>
@Lobotuerk Lobotuerk requested review from nkoenig and iche033 May 21, 2021 17:59
@github-actions github-actions bot added the 🔮 dome Ignition Dome label May 21, 2021
@nkoenig nkoenig changed the base branch from ign-rendering4 to ign-rendering5 June 7, 2021 20:17
@nkoenig nkoenig changed the base branch from ign-rendering5 to main June 7, 2021 20:18
@iche033 iche033 added 🏯 fortress Ignition Fortress and removed 🔮 dome Ignition Dome labels Jun 9, 2021
@@ -139,7 +139,8 @@ void main()
}

// clamp xyz and set rgb to background color
if (point.x > far - tolerance)
if (point.x * point.x + point.y * point.y >
(far - tolerance) * (far - tolerance))
Copy link
Contributor

Choose a reason for hiding this comment

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

how about just length(point) > far - tolerance to be consistent with how the gpu lidar clips ranges?

Similarly for clipping points within near clip plane: length(point) < near + tolerance

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, I had no idea there was a length function. Good catch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does 9bfe9d1 works?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that looks fine. INTEGRATION_depth_camera test caught this change and is failing. Can you update the test?

Can you also add a note about this change in the Migration.md guide?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Where should I note the change in the migration guide? 5 -> 6 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, you can add a new section Ignition Rendering 5.0 to 6.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

34267e4 should take care of this

@Lobotuerk
Copy link
Contributor Author

Given that the issue is about longer ranges, and that closer clipping is giving some issues that go farther than this PR, this is going to tackle only far clipping and not near clipping. The near clipping seems to be related to #356 (comment) , would need that fixed before near clipping can be done like far clipping

@codecov
Copy link

codecov bot commented Jul 7, 2021

Codecov Report

Merging #325 (9675ef6) into main (16014e7) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #325   +/-   ##
=======================================
  Coverage   58.16%   58.16%           
=======================================
  Files         170      170           
  Lines       16788    16788           
=======================================
+ Hits         9764     9765    +1     
+ Misses       7024     7023    -1     
Impacted Files Coverage Δ
...e/ignition/rendering/base/BaseGaussianNoisePass.hh 100.00% <0.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 16014e7...9675ef6. Read the comment docs.

@Lobotuerk Lobotuerk requested a review from iche033 July 7, 2021 15:35
@@ -139,7 +139,7 @@ void main()
}

// clamp xyz and set rgb to background color
if (point.x > far - tolerance)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make the same change to depth_camera_final_fs.glsl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@Lobotuerk Lobotuerk Jul 8, 2021

Choose a reason for hiding this comment

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

Changing both that and https://github.com/ignitionrobotics/ign-rendering/blob/lobotuerk/depthRangeChange/test/integration/depth_camera.cc#L309-L311 tomaxVal make all tests pass, but I don't think that makes sense

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 the problem is that because point was previously clamped to -inf so length(point) becomes +inf. So in depth_camera_final_fs.glsl we can change to something like:

if (!isinf(point.x) && length(point) > far - tolerance)

which just skips this additional clamping if it's already been clamped in the previous pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

34267e4 should take care of this

@Lobotuerk Lobotuerk requested a review from iche033 July 12, 2021 19:18
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.

@iche033 iche033 merged commit afa2270 into main Aug 3, 2021
@iche033 iche033 deleted the lobotuerk/depthRangeChange branch August 3, 2021 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏯 fortress Ignition Fortress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants