Workspace 6.21.5
Off-screen Rendering

Introduction

In many cases, instead of rendering directly to the interactive WSGLWidget, it may be desirable to render to an image off-screen. The image can then be saved to file, or composited with other images.

This tutorial provides an explanation of how to achieve off-screen rendering using Workspace. The steps involved are as follows:

A sample workflow has been provided for this tutorial.

Prerequisites

This tutorial assumes that you have completed the first two tutorials: Basic Rendering and Modifying a Model's Appearance. The steps in the tutorial build upon the workflow completed in the Model Appearance tutorial - if you did not complete this tutorial, please use the sample workflow for tutorial #2 as the basis to begin this tutorial.


1. Rendering a scene to an image

In this tutorial, we are going to render the output of tutorial #2 to an image. To do this:

  1. From the Rendering section of the Operation Catalogue, drag a WSGLOffscreenRender operation onto the workspace
    Creating the WSGLOffscreenRender operation
  2. Connect the Scene output of the SceneBuilder operation to the Scene input of the WSGLOffscreenRender operation

This is all we need to generate images. The WSGLOffscreenRender operation will output the images into its Image output.


2. Saving an image to file

To save our image to file, we need only create a single operation:

  1. From the Images section of the Operation Catalogue, drag a ImageWriter operation onto the workspace canvas.
    Creating the image writer
  2. Connect the Image output of the WSGLOffscreenRender operation to the Image input of the ImageWriter operation.
  3. Click on the ImageWriter to select it.
  4. In the Operation editor, enter a filename with the desired extension, e.g. .png (don't forget to include the absolute path).
  5. Right click on the dependency output of the ImageWriter operation, and click the Create Workspace Output option.
  6. Execute the workflow.

The scene will now have been written out to the specified file.

The completed workflow

Summary

We have now learned how to use the basic off-screen rendering capabilities of Workspace.

Next Steps

The next and final tutorial in this series will explain how to visualize Visualising volume datasets volume datasets using Workspace.