Configuring viewports

Viewport

A viewport is a rectangular area on your desktop in which your camera will display its rendering. A viewport must be assigned a camera.

If you want to display a stereoscopic picture on a particular viewport, you must assign a Stereoscopic Camera.

This will enable the stereoscopic options, such as StereoMode or StereoInvertEyes.

There are two stereo modes :

  • OpenGL Quad-Buffer : This is the mode for active stereoscopy.

  • Side-by-side : This is the mode for passive stereoscopy.

You can also manually create a passive stereo viewport by creating two distinct viewports and assign them the left and right cameras.

Properties

Table 5.12. Viewport properties

NameName of the viewport
LeftThe left pixel coordinate of the viewport. Can be negative, to display on a secondary monitor for example.
TopThe top pixel coordinate of the viewport. Can be negative, to display on a secondary monitor for example.
WidthWidth of the viewport in pixels.
HeightHeight of the viewport in pixels.
CameraThe camera assigned to this viewport. Required.
StereoModeThe stereoscopic mode of the viewport. Will be enabled if the Camera is a Stereoscopic camera.
CompressSideBySideIn case your display scales the side-by-side image horizontally, use this option to compress it.
StereoInvertEyesReverse the left-right eye rendering.
OculusRiftWarpingUsed by the Oculus Rift configurations to provide proper warping. Make sure to use a predefined configuration: the correct warping is also dependent on the proper viewport size, aspect ratio, cameras field of view etc.

Window

MiddleVR will create a single window that contains all your viewports. You can control the behavior with the following properties:

Table 5.13. Window properties

FullscreenWill the window go into fullscreen mode ?
WindowBordersIf the window is not fullscreen, keep the borders if set to true, remove them if set to false.
ShowMouseCursorHide the mouse cursor if set to false.
VSyncWill the window wait for vertical synchronisation ? This will be forced to true when an active stereoscopy viewport is detected.
Anti-AliasingSets the anti-aliasing level. Currently only available in Forward Rendering.

If your viewports span across multiple displays, you shouldn't use the Fullscreen mode, since it's only able to use your primary display. If you want to have viewports on several displays that look like fullscreen, disable Fullscreen and disable Borders.

Homography

In some cases, a homography transformation is needed on the displayed image to straighten the final visual result. This technique is particularly helpful to calibrate projector displays.

This feature is handled by the "Advanced" section of the viewport parameters:

Table 5.14. Homography parameters

UseHomographyWill this viewport use homography transformation?
HomographyTopLeftCornerOffsetXHorizontal position offset of the top left corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyTopLeftCornerOffsetYVertical position offset of the top left corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyTopRightCornerOffsetXHorizontal position offset of the top right corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyTopRightCornerOffsetYVertical position offset of the top right corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyBottomRightCornerOffsetXHorizontal position offset of the bottom right corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyBottomRightCornerOffsetYVertical position offset of the bottom right corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyBottomLeftCornerOffsetXHorizontal position offset of the bottom left corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.
HomographyBottomLeftCornerOffsetYVertical position offset of the bottom left corner destination point. This parameter is in pixels. Zero makes the corner be at it's original position.

There, by default, the image corners coordinates are set to the standard positions. Change these corners coordinates will stretch the viewport to fit the geometry described by the four points. Here is an example showing the same view with no homography and with homography using the viewport coordinates with a ( 100, 100 ) pixels offset for the top left corner and a ( -100, 100 ) pixels offset for the top right corner.

Without homography:

With homography:

You can correct a basic keystone, but you can go even further in the correction:

Debug information

MiddleVR has a few options to further investigate issues:

Table 5.15. Debug properties

LogLevelThe level of logs that will be printed in log files when the application runs.
LogInSimulationFolderTo write the logs in the .exe folder (in a new folder: MiddleVRLogs/). Note that when used in a cluster system and if cluster clients use a shared network folder, all clients will be writing the logs over the network. Depending on the loglevel, this can slow the application down significantly.
EnableCrashHandlerFor more serious crashes, this option will enable even more information to be logged. Warning: this option can render Unity more sensitive. If an exception is raised in Unity, the Crash Handler will catch it and quit immediately.

The log level can be from 0 to 7:

- LogLevel 0: will only display errors,

- LogLevel 1: will only display errors and warnings,

- LogLevel 2: will only display errors, warnings and information,

- LogLevel 3 or more: debug information.