RobotLocomotion / RobotLocomotion/drake
[render_vtk] Cloned instances can interfere with each other with textured models
- 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.

A1

A2

B1

A3

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
Assessment
This issue has not been assessed yet.