drake icon indicating copy to clipboard operation
drake copied to clipboard

Meshcat pointcloud isn't visible in 2D render mode (orthographic projection)

Open RussTedrake opened this issue 3 years ago • 0 comments

What happened?

Running the following code:

  geometry::Meshcat meshcat;
  meshcat.Set2dRenderMode(math::RigidTransformd(Eigen::Vector3d{0, 0, 1}), -2,
                          2, -2, 2);
  perception::PointCloud test_cloud(4);
  // clang-format off
  test_cloud.mutable_xyzs() << 0, 1, 1, 0,
                          1, 1, 0, 0,
                          0, 0, 0, 0;
  // clang-format on
  meshcat.SetObject("Box corners", test_cloud, 0.1, Rgba(0, 1, 0));
  meshcat.SetLine("Box", test_cloud.xyzs().cast<double>(), 1.0, Rgba(1, 0, 0));
  std::cout << "[Press RETURN to continue]." << std::endl;
  std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');

Results in meshcat showing red lines in the intended box location, but no green points. Commenting out the Set2dRenderMode line results in the visualization appearing as expected.

Frustratingly, the meshcat_manual_test does cover this case, and the point cloud looks fine in the perspective projection.

I'm not sure if Drake is responsible, or meshcat, or three.js, etc. But I'll open this for awareness and tracking.

Version

No response

What operating system are you using?

Google Chrome on Ubuntu 20.04.

What installation option are you using?

Building from source (on master).

Relevant log output

No response

RussTedrake avatar Jul 26 '22 15:07 RussTedrake