Skip to content

Commit

Permalink
Fix depth alpha (#316)
Browse files Browse the repository at this point in the history
* update test

Signed-off-by: Ian Chen <[email protected]>

* reenable macos test

Signed-off-by: Ian Chen <[email protected]>

* fix typo

Signed-off-by: Ian Chen <[email protected]>
  • Loading branch information
iche033 committed Jun 14, 2021
1 parent 57c1ec2 commit 86a15c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
13 changes: 10 additions & 3 deletions test/integration/depth_camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ void DepthCameraTest::DepthCameraBoxes(
// Note: If it fails here, it may be this problem again:
// https://github.com/ignitionrobotics/ign-rendering/issues/332
EXPECT_GT(mb, 0u);
EXPECT_EQ(255u, ma);

// Far left and right points should be red (background color)
float lc = pointCloudData[pcLeft + 3];
Expand All @@ -265,7 +264,6 @@ void DepthCameraTest::DepthCameraBoxes(
EXPECT_EQ(255u, lr);
EXPECT_EQ(0u, lg);
EXPECT_EQ(0u, lb);
EXPECT_EQ(255u, la);

float rc = pointCloudData[pcRight + 3];
uint32_t *rrgba = reinterpret_cast<uint32_t *>(&rc);
Expand All @@ -277,7 +275,16 @@ void DepthCameraTest::DepthCameraBoxes(
EXPECT_EQ(255u, rr);
EXPECT_EQ(0u, rg);
EXPECT_EQ(0u, rb);
EXPECT_EQ(255u, ra);

// Note: internal texture format used is RGB with no alpha channel
// We observed the values can be either 255 or 0 but graphics card
// drivers are free to fill it with any value they want.
// This should be fixed in ogre 2.2 in ign-rendering6 which forbids
// the use of RGB format.
// see https://github.com/ignitionrobotics/ign-rendering/issues/315
EXPECT_TRUE(255u == ma || 0u == ma);
EXPECT_TRUE(255u == la || 0u == la);
EXPECT_TRUE(255u == ra || 0u == ra);
}

// Check that for a box really close it returns it is not seen
Expand Down
17 changes: 10 additions & 7 deletions test/integration/render_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ void RenderPassTest::DepthGaussianNoise(const std::string &_renderEngine)
EXPECT_NEAR(0u, mr, colorNoiseTol);
EXPECT_NEAR(0u, mg, colorNoiseTol);
EXPECT_GT(mb, 0u);
EXPECT_EQ(255u, ma);

// Far left and right points should be red (background color)
float lc = pointCloudData[pcLeft + 3];
Expand All @@ -367,7 +366,6 @@ void RenderPassTest::DepthGaussianNoise(const std::string &_renderEngine)
EXPECT_NEAR(255u, lr, colorNoiseTol);
EXPECT_NEAR(0u, lg, colorNoiseTol);
EXPECT_NEAR(0u, lb, colorNoiseTol);
EXPECT_EQ(255u, la);

float rc = pointCloudData[pcRight + 3];
uint32_t *rrgba = reinterpret_cast<uint32_t *>(&rc);
Expand All @@ -379,7 +377,16 @@ void RenderPassTest::DepthGaussianNoise(const std::string &_renderEngine)
EXPECT_NEAR(255u, rr, colorNoiseTol);
EXPECT_NEAR(0u, rg, colorNoiseTol);
EXPECT_NEAR(0u, rb, colorNoiseTol);
EXPECT_EQ(255u, ra);

// Note: internal texture format used is RGB with no alpha channel
// We observed the values can be either 255 or 0 but graphics card
// drivers are free to fill it with any value they want.
// This should be fixed in ogre 2.2 in ign-rendering6 which forbids
// the use of RGB format.
// see https://github.com/ignitionrobotics/ign-rendering/issues/315
EXPECT_TRUE(255u == ma || 0u == ma);
EXPECT_TRUE(255u == la || 0u == la);
EXPECT_TRUE(255u == ra || 0u == ra);
}

// Clean up
Expand All @@ -399,11 +406,7 @@ TEST_P(RenderPassTest, GaussianNoise)
}

/////////////////////////////////////////////////
#ifdef __APPLE__
TEST_P(RenderPassTest, DISABLED_DepthGaussianNoise)
#else
TEST_P(RenderPassTest, DepthGaussianNoise)
#endif
{
DepthGaussianNoise(GetParam());
}
Expand Down

0 comments on commit 86a15c7

Please sign in to comment.