OSPRAY - should-clear bit in vtkOSPRayRendererNode isn’t triggering when it should.
When in scivis mode
vtkOSPRayRendererNode::SetAmbientSamples(1, this->GLRenderer);
this->GLRenderer->GetRenderWindow()->Render();
this->GLRenderer->GetRenderWindow()->Render();
this->GLRenderer->GetRenderWindow()->Render();
this->GLRenderer->GetRenderWindow()->Render();
this->GLRenderer->GetRenderWindow()->Render();
this->GLRenderer->GetRenderWindow()->Render();
After each render pass the image will get “lighter” and “lighter” accumulating.
I have been able to duplicate in VTK using TestRendererType and by modifying the vtkOSPRayTestInteractor so that via the interactor and key presses a render pass occurs with each key press.
In this case ospray renders again and blends in the new pixels on top of the old ones rather than restarting afresh.
If I do the following:
vtkOSPRayRendererNode::SetAmbientSamples(1, this->GLRenderer);
this->GLRenderer->GetRenderWindow()->Render();
rotate the image
The image gets "lighter" as the rotate is forcing a clear to happen where as just doing a render does not.
I have discussed this issue with @demarle as he has seen it before. He suggested that I set the Accumulate flag in vtkOSPRayRendererNode to false so that ospFrameBufferClear (line 1524) is called. This change appeared to verify the issue.
We believe the canReuse flag is not fully checking everything so to invoke a ospFrameBufferClear (line 1511). In my case changing the SetAmbientSamples from 0 to 1 should have caused canReuse to be false. There is also this comment on line 1377:
// TODO: these all need some work as checks are not necessarily fast
// nor sufficient for all cases that matter
I added a test pseudo test on the ambient samples that resulted in can reuse being false and that solve the problem. However, my test is a hack.
Brain storming here: When vtkOSPRayRendererNode::SetAmbientSamples is called could it also call vtkInformation::Modified to trigger an event which then vtkOSPRayRendererNode picks up so to invalidate the the canreuse flag????