Closed SeanCurtis-TRI closed 3 years ago
On my Puget, this example
bazel run //geometry/profiling:contact_surface_rigid_bowl_soft_ball
was captured in these three movies to show how contact visualization performs right now. In the first movie with both contact pressure and contact mesh, I saw only one frame for the entire 10s sim. In the second movie with only contact mesh no pressure, the movie has more frames to show. The third movie hides the contact surface and shows the real time factor about 1.0X.
Thanks to @xuchenhan-tri for planning to work on it.
Resolved by #14622
Problem
Visualization of hydroelastic contact surfaces in
drake_visualizer
is painfully slow. While part of this may be attributed to compactness of LCM messages or inefficient mesh topologies (e.g., duplicate vertices), the primary cause comes down to how the mesh is expressed to VTK: as a bunch of individual polygons.Diagnosis
By registering each mesh triangle as its own VTK entity, the rendering of the mesh becomes CPU bound instead of GPU bound. More meshes are more VTK objects where each is processed in a large generic fashion. Instead, if all vertex- and triangle-data were stored as a single mesh, it would be a single object and the GPU would be doing all the heavy lifting.
Solution
Use the data in the LCM message to populate the polydata of a single polygonal object.