RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.29k stars 1.26k forks source link

RenderEngineVtk cloning yields rendering artifacts #22044

Open SeanCurtis-TRI opened 2 days ago

SeanCurtis-TRI commented 2 days ago

What happened?

In #22025, a test in render_engine_vtk_test.cc had to be disabled for EGL. This failure is not unique to the EGL backend. More robust testing shows that EGL merely provided a context which exposed an underlying problem.

Do the following:

bazel run //tools:model_visualizer_private -- --show_rgbd_sensor \
    package://drake/geometry/render/test/meshes/rainbow_box.obj

As you rotate the view and look at the box's blue face, you'll observe something like the following:

output

What you see is that the blue, green, and red faces are always drawn. However, they are drawn with incorrect classification of "in front". The red face is always considered in front of the green and the green is always considered in front of the blue. And this is with the GLX backend. In fact, the test in render_engine_vtk_test.cc would also fail if it were phrased differently. It's simply insufficiently sufficient to recognize this failure.

In fact, from bisection, it becomes apparent that the failure was introduced in #20944. Checkout 949aa201e265b51c0c3607de8c2b21b2d948534c and run the command above and you'll observe the same artifacts. (For this older commit, it may be necessary to place the .obj in a dummy .sdf file to facilitate the parsing functionality at the time of that commit.)

Note: this only happens with the cloned RenderEngineVtk engine. The original render engine produces correct images (which can be observed by looking at the test output for the MultiMaterialObject.

Version

No response

What operating system are you using?

No response

What installation option are you using?

No response

Relevant log output

No response

SeanCurtis-TRI commented 1 day ago

I just killed the hypothesis that cloning is the cause of the problem. I created a commit that eliminated cloning (by sharing render engines across contexts). The problem persists. So, this is something more fundamental, but finicky enough that it's problems aren't obvious.

SeanCurtis-TRI commented 18 hours ago

The true resolution is in #22053 -- the description there describes the resolution.