Graphics Reference
In-Depth Information
3D-enabled digital television decomposes the single
image back into decimated left and right images,
doubles its refresh rate to 120 Hz, and alternately
displays the images: left-right-left-right-… Viewers
wear shuterglass stereo eyewear to channel the
proper image into the proper eye.
Fortunately, existing programs can be adapted
fairly easily to produce this spatially-interlaced sig-
nal. A left eye and right eye view would need to
be rendered, each to its own texture. A fragment
shader, shown below, would then create the check-
erboard interlace patern. A simple way to do that
would be to use the built-in gl_FragCoord window-
relative pixel-space coordinates, to decide whether
this fragment should receive the left eye image or
the right.
Figure 11.9. Left and right eye views being
combined into a single spatially interlaced
image.
uniform sampler2D uLeftUnit, uRightUnit;
in vec2 vST;
out vec4 fFragColor;
void main( )
{
int row = int( gl_FragCoord.y );
int col = int( gl_FragCoord.x );
int sum = row + col;
vec4 color;
if( ( sum % 2 ) == 0 )
color = texture( uLeftUnit, vST );
else
color = texture( uRightUnit, vST );
fFragColor = vec4( color.rgb, 1. );
}
Here is an example of what this looks like. Figure 11.10 shows left and
right eye images. (In this case they were taken with a stereo camera, but they
could just have easily been computer-generated.) The spatially interlaced
image is also shown as part of Figure 11.10, along with a zoomed-in view more
clearly showing the checkerboard interlacing patern.
Search WWH ::




Custom Search