Hi Friends,
I’m using off screen rendering to make “shots” of a VTK scene.
I have a Main Renderer containing actors, and a List of actors “ActorsToShoot” to shoot.
The technic I’m using is quit simple (C# pseudo code) :
var OffScreenWindow = new RenderWindow();
var OffScreenRenderer = new Renderer();
OffScreenWindow.SetOffScreenRendering(true);
OffScreenWindow.SetMultiSamples(8);
OffScreenWindow.AddRenderer(OffScreenRenderer);
OffScreenWindow.SetSize(2000, 2000);
///Props
ActorsToShoot.ForEach(a => OffScreenRenderer.AddViewProp(a));
OffScreenRenderer.ResetCameraScreenSpace();
OffScreenRenderer.ResetCameraClippingRange();
try
{
///Shoot
return OffScreenWindow.ShootToPNG(); ///helper method that uses vtkWindowToImageFilter + vtkPNGWriter
}
finally
{
OffScreenWindow.Dispose(); ///calls ren->SetRenderWindow(nullptr);
OffScreenRenderer.Dispose(); ///calls this->RemoveAllViewProps();
}
Works great but :
After the shoot, the “ActorsToShoot” actors disappear from the main Renderer.
To make same reappear, I have to move the camera somehow (Pan, Rotate, …).
ResetCamera() / ResetCameraClippingRange() is not enough to make actors reappear.
Any idea ?
Tks !