[vtkusers] VTK Offscreen Rendering

Kevin H. Hobbs hobbsk at ohiou.edu
Thu Apr 16 05:04:10 EDT 2009


Simon Drouin wrote:
> I use vtkRenderLargeImage (which renders large images by succesively 
> rendering small portions of it)  that connects to a vtkRenderer and 
> produce a vtkImageData as an output, that can then be saved to a file 
> using something like vtkPNGWriter.
>
> I have 2 problems with that method though.
>
> 1 - With volume rendering, I get 1 pixel wide lines at the separation 
> of the blocks (I suspect it is a bug in vtkRayCastImageDisplayHelper)

This topic is being discussed in another thread.

> 2 - When rendering animation, I need to create a new 
> vtkRenderLargeImage everytime I change frame otherwise, it 
> vtkRenderLargeImage always outputs the same frame even though the 
> scene is changing.

I do not use vtkRenderLargeImage. There is supposed to be some way to 
reuse these objects with the Modified methods but I've never made it 
work. I always end up creating a new vtkRenderWindow, 
vtkWindowToImageFilter, and vtkPNGWriter for each frame. I absolve 
myself by thinking about the few miliseconds these objects take to be 
created, execute, and be destroyed, compared to the minutes it takes to 
volume render a large volume.

> 3 - There doesn't seem to be a way to avoid displaying a render window 
> on the screen (at least it is the case on OSX with VTK built on 
> COCOA). I have tried to set OffScreenRenderingOn on the window right 
> after it is constructed (before any render occurs) and it is still 
> showing the window.
>
> s.


I can't really comment about OSX, osmesa, and VTK but when I do 
offscreen rendering on linux with osmesa I was told to :

#include "vtkGraphicsFactory.h"
#include "vtkImagingFactory.h"

and before I create any other VTK objects to :

  // Graphics Factory
    vtkGraphicsFactory * graphics_factory
        = vtkGraphicsFactory::New();
    graphics_factory->SetOffScreenOnlyMode( 1);
    graphics_factory->SetUseMesaClasses( 1 );

  // Imaging Factory
    vtkImagingFactory * imaging_factory
        = vtkImagingFactory::New();
    imaging_factory->SetUseMesaClasses( 1 );


then once I've created a render window to :

    render_window->SetOffScreenRendering( 1 );

I hope this helps.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090416/3a531894/attachment.pgp>


More information about the vtkusers mailing list