Research and implementation of stereoscopic display technology in virtual reality

Publisher:捡漏来了Latest update time:2011-12-16 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

Virtual Reality is an emerging and promising comprehensive computer technology. Modern high technology with computer technology as the core is used to generate a virtual environment of a specific range that integrates realistic vision, hearing and touch. Stereoscopic display is one of the key technologies of virtual reality. It makes people feel more immersed in the virtual world. The introduction of stereoscopic display can make the simulation of various simulators more realistic. Research stereoscopic imaging technology and use the existing microcomputer platform, combined with the corresponding software and hardware systems to display stereoscopic scenes on flat-panel displays.

2 Overview of Stereo Vision

According to research, the human brain can obtain depth (distance) clues from the following four aspects: depth clues in static images, depth clues caused by movement, physiological depth clues, and binocular parallax clues. Here, only binocular parallax clues are studied. When looking at the same scene with both eyes, due to the different positions of the left and right eyes in space, the perspectives of the two eyes will be different, and the images seen will also be different, with parallax, as shown in Figure 1a. The binocular images with parallax are fused by the brain to produce a stereoscopic image containing stereoscopic depth information. Generally, a pair of two-dimensional images with parallax seen by both eyes is called a stereoscopic image pair. If this pair of plane images is simulated and technical measures are taken so that the left eye can only see the image on the right and the right eye can only see the image on the left, the human visual system will fuse a pair of slightly different images in the two-dimensional space, thereby generating an image with a stereoscopic perception. According to the relative positions between the projection surface, the human eye and the observed object, there can be positive parallax (Figure 1b), negative parallax (Figure 1c) and zero parallax (Figure 1d).

3 Dual-center projection algorithm

From the above research, we can know that the generation of stereo image pairs is due to the different perspective results of objects observed by the left and right eyes. Therefore, two virtual eyes are set in the visual simulation of stereo display, one to obtain the image of the left eye and the other to obtain the image of the right eye, and the images of the left and right eyes are transmitted to the corresponding eyes respectively. Therefore. In stereo display, it is necessary to adopt a perspective projection method involving two viewpoints, a dual-center projection algorithm. Figure 2 shows the dual-center projection.

The left viewpoint Leye and the right viewpoint Reye are both on the X-axis. The distance between the two viewpoints is e. The center of the line connecting the two viewpoints is the origin of the coordinate system. The coordinates of the left viewpoint are (-e/2, 0, 0) and the coordinates of the right viewpoint are (+e/2, 0, 0). The projection plane is parallel to the XY plane, and the distance to the left and right viewpoints is d. The coordinates of a point P (xp, yp, zp) in the left viewpoint projection are (xl, yl, zl), and the coordinates of a point P (xr, yr, zr) in the right viewpoint projection are (xr, yr, zr), then zl=zr=d. The parametric equations of point P (xp, yp, zp) and the Reye projection line are:

It can be seen that when zp>d, 0

4. OpenGL realizes stereoscopic display

OpenGL (Open Graphic Library) is a 3D computer graphics and model library. It is independent of the operating system and hardware environment and is suitable for a wide range of computer environments from personal computers to workstations.

OpenGL has excellent performance in the production of 3D realistic graphics. This graphics library can not only easily produce high-quality still color images, but also create high-quality animation effects. With the help of the Windows programming environment, the human-computer interaction of the model can also be controlled. Due to its openness and high reusability, it has become an industry standard.

4.1 Rendering of Stereo Image Pairs

After calculating the stereo image pair according to the above projection algorithm, OpenGL is used to draw the stereo image pair, and the images for the right eye and left eye are drawn in red and green respectively. Take a cube with a length of 10 cm and a center point at the origin as an example. Assume that the distance e between the two viewpoints is 5 cm, and the distance d between the projection surface and the observer is 40 cm. Consider a vertex (5, 5, 5) of the cube. According to the above projection algorithm, we can get: xr=32 cm, xl=48 cm, yl=yr=4040 cm, zr=zl=d=40 cm. After calculating the eight vertices respectively, connect the corresponding stereo perspective projection points to get the stereo image pair of the cube. Use array vertex[8][3] to store the vertices, array translatetexr[8][3] to store the coordinates after the right eye projection calculation, and array translatetexl[8][3] to store the coordinates after the left eye projection calculation. Perform projection calculations on the corresponding points:


When using OpenGL's perspective projection transformation, you need to set the distance between the front and rear clipping planes and the observer, as well as the width and height of the front clipping plane. The width of the front clipping plane is expressed as the ratio of the width to the height, which is the ratio of the width to the height of the display window.

double Near.Far;//The distance between the front and back clipping surfaces and the observer

int ratio=width/height; //Ratio of the width and height of the display

ViewHeight2=Near*tan(radians); //Calculate the height of the field of view

ViewWidth2=ViewHeight2*ratio; //Calculate the width of the field of view

Calculate the visual field of the right eye;

left=-ViewWidth2-0.5*e*0.3;

right=ViewWidth2-0.5*e*0.3;

Project and draw the model:

glFrustum(left, right, bottom, top, Near, Far);

glDrawBuffer(GL_BACK_RIGHT); //Use the back right buffer

gluLookAt(0+e/2.0,5.0+d/2,0,-5,0,1,0);

//Determine the right eye position

glColor3f(1.0, 0.0, 0.0); //Draw with red

draw(); // Calculate and draw a stereo image pair

Similarly, draw the image of the left eye, as shown in Figure 3.

4.2 Use of double buffer

OpenGL provides double buffering technology, which supports hardware or software with two complete color buffers. When drawing one buffer, the contents of the other buffer are displayed. The buffers are swapped after each frame is drawn; the buffer just displayed is used for drawing, and the buffer used for drawing is displayed. In this way, when the display is refreshed, the buffer areas are swapped and the picture will not flicker.

OpenGL also supports stereoscopic viewing, implementing left color buffer and right color buffer, which are used for left stereo images and right stereo images respectively. During initialization, the parameters PFD_DOUBLEBUFFER and PFD_STEREO_DONTCARE can be used to support stereo display and double buffering. When using double buffering, usually only the back buffer is drawn. The function glDrawBuffer() can also specify that the stereo image is rendered to a specific buffer.

For example, when drawing the right eye image, use the right back buffer glDrawBuffer(GL_BACK_RIGHT), and when drawing the left eye, use the left back buffer glDraw-Buffer(GL_BACK_LEFT).

4.3 Observation of Stereoscopic Images

A simple filter can be used to observe a three-dimensional image. The principle is: because the filter (red and green filters are used in the experiment) absorbs other light and only allows light of the same color to pass through, the left and right eyes each transmit light of different colors. When using filters to observe a pair of stereo images on a computer screen, you will see an image with a sense of depth. In the experiment, it was found that the refresh rate plays an important role in the formation of the three-dimensional effect of the image. If the refresh rate is too low, the image maintained by the human eye has disappeared, and the three-dimensional stereoscopic feeling cannot be obtained; if the refresh rate is too high, one eye will see two images. Set the display refresh rate appropriately, set the image refresh rate to 50 Hz in the program, and use red and green filters to observe the three-dimensional imaging of the model to obtain a more obvious three-dimensional visual effect.

5 Conclusion

According to the principle of stereoscopic display, the binocular parallax algorithm is used to display objects in stereoscopic form, and OpenGL is used to generate stereoscopic image pairs. With the help of red and green filter glasses, a good stereoscopic visual effect is obtained. The introduction of stereoscopic display technology enhances people's immersion in virtual environments and can be widely used in many occasions such as building and visual roaming, virtual war training grounds, and various simulation training.

Reference address:Research and implementation of stereoscopic display technology in virtual reality

Previous article:Application of LED dot matrix digital mixed display in sports stadiums
Next article:Design of a wireless switch system for intelligent home lighting control

Latest Security Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号