The Scaleform Stereo API

For consoles, Scaleform 4 includes a simple API in Render::HAL, for supporting stereo 3D. It is up to the application to initialize the hardware for stereo 3D and set up the frame buffers and surfaces to support HDMI 1.4 frame packing.

Initially, the application should initialize the stereo parameters it wants in the Scaleform renderer, as shown in Scaleform Stereo Initialization

Scaleform 4 provides the ability to set the viewport to render separate stereo images side by side or top and bottom. This is a convenience for devices which require stereo images to be tiled vertically or horizontally.

This can be done by calling Render::Viewport::SetStereoViewport with the appropriate flag.

Here are the new Viewport Stereo option flags that were added to SF4:

    // For stereo in display hardware only; uses the same size buffer but half
       for each eye.
    View_Stereo_SplitV        = 0x40,
    View_Stereo_SplitH        = 0x80,
    View_Stereo_AnySplit    = 0xc0,

void SetStereoViewport(unsigned display);

Scaleform Stereo Initialization

Render::StereoParams s3DInfo;
s3DInfo.DisplayDiagInches = 46;     // 46 inch TV
s3DInfo.DisplayAspectRatio = 16.f / 9.f; // widescreen aspect ratio
s3DInfo.Distortion = .75;           // 0 to 1 value
s3DInfo.EyeSeparationCm = 6.4;  // this will default 6.4cm
pRenderHAL->SetStereoParams(s3DInfo);

During the display traversal, the application should call Display twice, once for each eye, and take care of switching to the correct frame buffer surface before each Display call. Scaleform will handle offsetting the view for each eye. For example:

pMovie->Advance(delta);

pRenderer->GetHAL()->SetStereoDisplay(Render::StereoLeft, 0);
pMovie->Display();

pRenderer->GetHAL()->SetStereoDisplay(Render::StereoRight, 0);
pMovie->Display();

The second parameter in SetStereoDisplay indicates whether the drawing surface should be changed or not when rendering stereo images. If set to true (or 1), the render target is reset.