RobotLocomotion / RobotLocomotion/drake

[render_vtk] Cloned instances can interfere with each other with textured models

Open
#20,002 4 comments 0 reactions 1 assignee Claimed by @SeanCurtis-TRI View on GitHub
component: geometry perception priority: medium type: bug
Dominant language
C++
Stars
4.2k
Forks
1.4k
Avg merge
3d 19h
Merged PRs (30d)
70

Description

### What happened?

This is subtle, but when a render engine gets cloned and we perform interleave renderings between the two engines, they somehow interfere with each other.

The best understanding of this bug is best articulated in [this branch](https://github.com/SeanCurtis-TRI/drake/tree/BUG_render_engine_vtk_clone_interference). It has a test that illustrates the bug.

In short, if I had a `RenderEngineVtk A;` and I defined `auto B = A.clone();`, and then call `A.RenderColorImage()` and `B.RenderColorImage()` alternatingly (without changing anything else), I should get the same image over and over. I don't.

1) The first image from A and B may not disagree (depending on the definition of the materials being rendered).
2) If I render A - B - A, then all renderings from A starting with its second have terribly incorrect materials (the ones that originally had textures). If I reversed the ordering to B - A - B, then the situations reverse and B's images (from the second onward) are messed up.

Below, I've attached the images from the linked test. The rendering pattern is A1 - A2 - B1 - A3 - B2.

- A1 and A2 match (we can render from A multiples times without problems).
- B1 *looks* similar but its material is slightly different - the diffuse value has been lost.
- A3 is completely messed up.
- B2 matches B1 -- B is not harmed (beyond its original error) for interleaved rendering.

![image_A1](https://github.com/RobotLocomotion/drake/assets/22159799/c885d045-d421-4516-8848-6691cbe5a694)
A1

![image_A2](https://github.com/RobotLocomotion/drake/assets/22159799/862cc5b9-d576-45a8-add5-f94172afe90c)
A2

![image_B1](https://github.com/RobotLocomotion/drake/assets/22159799/b654a9d5-25cc-4f63-b6e9-c8a06069a474)
B1

![image_A3](https://github.com/RobotLocomotion/drake/assets/22159799/b3ba1f2c-fa5d-410b-aba0-d9b81fa4d69d)
A3

![image_B2](https://github.com/RobotLocomotion/drake/assets/22159799/32e711b8-645b-4243-9e96-237d717fa3b6)
B2

### Version

@75114dca8d

### What operating system are you using?

Ubuntu 22.04

### What installation option are you using?

compiled from source code using Bazel

### Relevant log output

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.