instantreality 1.0

Multiple Windows and Views

Keywords:
tutorial, X3D, world, engine, multi view
Author(s): Marcus Roth, Patrick Riess
Date: 2007-11-27

Summary: This tutorial describes the configuration of multiple windows and multiple view areas per window. It is a precondition for the tutorials of this section and the Clustering section.

Preconditions for this tutorial

Please read the "Engine" tutorial if you are not yet familiar with the concept of different Context base elements.

Engine configuration

First we try to get some basic window settings right. Therefore we have to setup the RenderJob. In the engine section that is used for local rendering, the definition for the rendering in most cases looks like the following line:

DEF render RenderJob {}

Instant Reality automatically adds the missing configuration to produce an image on a local window. To be able to understand more complex rendering configurations, we'll have a short look at the automatically generated configuration for a local window.

Code: Simple local window configuration

...
DEF render RenderJob {
  windowGroups [
    WindowGroup {
      windows [
        LocalWindow {
          size 512 512
          views [
            Viewarea {
              lowerLeft  0 0
              upperRight 1 1
            }
          ]
        }
      ]
    }
  ]
}
...
          

With this configuration we have one local window with one Viewarea that covers the whole window.

Multiple view areas

To create a second view area we just have to add a Viewarea node and define the region where it should appear in the window. 0 means the left or bottom side and 1 is the right or top. If you set values greater than 1, they are interpreted as pixel values. In each view area, the complete scene is rendered.

Image: Concept of view areas in a window

The code for putting two view areas next to each other will look like this:

Code: Two view areas in a local window configuration

...
DEF render RenderJob {
  windowGroups [
    WindowGroup {
      windows [
        LocalWindow {
          size 800 400
          views [
            Viewarea {
              lowerLeft  0 0
              upperRight 0.5 1
            }
            Viewarea {
              lowerLeft  0.5 0
              upperRight 1 1
            }
          ]
        }
      ]
    }
  ]
}
...
        
Image: Two view areas next to each other a local window

View areas can be modified in a way to change the camera position and orientation by ViewModifier nodes. This is especially used for stereo configurations and CAVE environments (see appropriate tutorials or nodetype tree documentation).

Multiple windows

Multiple windows can be configured by adding LocalWindow nodes into the RenderJob section:

Code: Multiple local windows configuration

...
DEF render RenderJob {
  windowGroups [
    WindowGroup {
      windows [
        LocalWindow {
          size 800 400
          position 0 0
          views [
            Viewarea {
              lowerLeft  0 0
              upperRight 0.5 1
            }
            Viewarea {
              lowerLeft  0.5 0
              upperRight 1 1
            }
          ]
        }
        LocalWindow {
          size 300 300
          position 500 500
          views [
            Viewarea {
              lowerLeft  0 0
              upperRight 1 1
            }
          ]
        }
      ]
    }
  ]
}
...
        
Files: