I recently ran into something similar to this issue: vtkShadowMapPass causes actor picking doesn't work,and the actors with vtkUnstructuredGrid source don't show anymore. To summarize the issue: installing a render pass onto a renderer by calling vtkRenderer::SetPass() forces the use of that pass for all rendering, even when the renderer is being used for the purposes of hardware selection. This means that installing a render pass usually breaks hardware selection.
Looking into the source code, it appears that this is caused by the following code in vtkOpenGLRenderer::DeviceRender():
if (this->Pass != nullptr)
{
// This branch delegates all rendering to this->Pass
}
else
{
// This branch does the default rendering
}
I’m wondering if it would make sense to give the client of vtkRenderer more control over when their installed render pass runs and when the default rendering behavior runs. Specifically, would it make sense to add a flag like vtkRenderer::SkipCustomPassForHardwareSelection? When this flag was turned on, it would cause the renderer to skip the custom pass and instead follow its default behavior, but only if it is being used for hardware selection. Something like this:
bool skipCustomPass = this->SkipCustomPassForHardwareSelection && this->Selector != nullptr;
if (this->Pass != nullptr && !skipCustomPass)
{
// This branch delegates all rendering to this->Pass
}
else
{
// This branch does the default rendering
}
Would this be a desired feature, or is there already another standard solution to this problem?