Enables the game to display stereoscopic effects through red and blue stereo glasses

Source: Internet
Author: User

I believe most people often see three-dimensional images through red-blue or red-green glasses. The use of red-blue or red-green glasses in a variety of ways of three-dimensional image observation should be the lowest cost and the easiest way to achieve, although this method has the disadvantages of poor color reproduction and eye fatigue, but it still has good results and is worth trying.
The main principle of viewing a three-dimensional image is to let the two glasses respectively watch two pictures with a certain parallax. The difference between the two pictures is just equivalent to placing the two cameras in the positions of the two eyes, view the two images taken at the same visual interest point. These two parallax images are displayed through the red and blue channels of the display device, respectively, the filtering effect of the two lenses of red and blue glasses enables the left and right eyes to see the images in the red channel and blue channel of the display device respectively, thus realizing the three-dimensional effect of the image. In actual use, blue lenses are usually made light and slightly green, so that only the red light can be blocked and the blue-green light can pass through, so as to achieve better color reproduction, it provides a higher brightness and makes it easier to observe the stereoscopic effect.


Next we will talk about three-dimensional painting.Program. First, keep the original camera of all 3D programs, whether it is the first person or the third person. Get the camera's position and watching point before rendering each frame, and translate the camera's position to the left and right sides of the camera, which is equal to half the distance between the human eyes to get two new positions, camera A and camera B are placed in these two positions respectively, watching the same watching point as the main camera. Use camera a and camera B as the active cameras respectively to render the scene to two pasters TA and TB. Create a rectangle that overwrites the full screen, and use a shader program to mix the red channel of the texture TA with the green and blue channels of the texture TB and output them to the screen to get the expected stereoscopic image.
In addition, it should be noted that the angle width set by the program camera is closer to the angle width of the image we observe, the better the effect, we observe that the viewpoint of the image and the observation viewpoint of the program camera are closer to the stereoscopic effect, the better.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.