Skip to main content

Stereo

The Stereo plugin performs stereo-to-anaglyph conversion, enabling stereoscopic 3D rendering on standard monitors using common anaglyph glasses. It supports multiple rendering modes, including red-green, red-blue, red-cyan, magenta-cyan, and left-right output.

info

It is possible to disable shadow map rendering for the right frame so that shadow maps are reused from the left viewport, improving performance.

info

This plugin is integrated into Tellusim Executor.

#include <render/stereo/include/TellusimStereo.h>

Example

// Create Stereo instance with red-cyan mode
RenderStereo render_stereo;
if(!render_stereo.create(device, window.getSurface(), RenderStereo::ModeRedCyan)) return false;

// Create left and right eye frames, disabling shadow map rendering for the right frame
RenderFrame render_frames[2];
for(uint32_t i = 0; i < TS_COUNTOF(render_frames); i++) {
render_frames[i] = RenderFrame(render_system.getManager(), sample_camera.getNode(), i);
if(i) render_frames[i].setShadowMapSize(Maxu32);
}

// Render both stereo views
if(!render_system.render(device, render_frames, TS_COUNTOF(render_frames))) return false;

// Composite stereo frames into a single anaglyph output
target.begin();
{
Command command = device.createCommand(target);
bool flipped = (target.isFlipped() ^ render_system.isFlipped());
render_stereo.draw(command, render_frames, flipped);
}
target.end();