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
2 changes: 1 addition & 1 deletion ogre2/src/media/materials/programs/depth_camera_fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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

if (length(point) > far - tolerance)
{
if (isinf(max))
{
Expand Down