Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

3D stereoscopic rendering

Sign in to follow this  


Hi everyone!

Despite of my studies I'm always trying to find the time to write articles about my works. Today, let's talk about stereo 3D. The question is: Could I transform my game Theolith into a stereo 3D game?

First, I'll talk to people how don't really know how to render a stereo 3D scene: If you want to see a 3D photo, movie or video game, you must have 2 images: one for the left eye, and the other for the right eye. The first problem is: How put the good image on the good eye. The first solution that has been used since a very long time is to remove the red component of the right image and to remove the green and blue components of the left image and you add the 2 images. Then, with anaglyph glasses each eye just sees its image. The problem of this method is that we have a loss of colors because we must remove color components for each image. Since some years, technologies evolve and we are now able to get the good image to the good eye without losing color data. The best quality way is to display alternatively the right and the left image synchronized with glasses that will alternatively mask the left and the right eye.

Ok now about my game. I just have old cyan-red anaglyph glasses so I will program for this solution, but the idea is the same that with latest technologies: I need to get 2 correct images. For a non-stereo 3D game, you just have one camera defined by its position and its look-at point. In a stereo 3D game, you will need 2 cameras (left and right eyes). Their positions are easy to find you just have to slightly shift the non-stereo camera on the left and on the right. The problem is to find the look-at (or focus) point.

Imagine that you want to render this scene:

Here is the configuration with one camera: as all 3rd person games, the camera looks at the hero.

So my first idea with 2 cameras was to look at the hero:

But here is the problem: The more an object is far, the more it will be shift between the two eyes, the more the brain won't be able to deal with those 2 images. Here, if our eyes focus on the robot, the 3D seems ok, but if they focus on the mountains, it's ugly.

The problem is that we don't know where the eyes of the player will be, so I concluded that, if you want to have a correct 3D image, the only way is to focus on the furthest object:

Here is the 3D image. Despite of the bad quality of this JPEG, if you have cyan-red anaglyph glasses, you could notice that the 3D isn't so bad.

About the first solution, I think there is a way if you really want to force the player's eyes to focus on the robot and not on the mountains; it could be to implement a depth of field. It would render something like that (this ugly image is just an idea made with an image editor):

Ok! That's enough for today! The main message of this article is to understand the difficulty to choose the good focus. Be aware of the problem if you intend to start stereo 3D stereoscopic programming. For the moment, I'm a beginner in this topic, so if you see any mistakes, if you have any remarks, suggestions I would be happy to know them!
In a further article, I intend to speak of stereo programming: How to configure shaders in order to blend the left and the right image. But this blending isn't the more interesting, because it's quite deprecated: more and more people will have electronic 3D glasses, so they don't need a blend but just to display alternately the right and the left camera.

Have a great day!
Sign in to follow this  


Recommended Comments

Good work. [smile] It's always good to read about work with stereoscopic 3D!

A hardware-supported way to output a stereoscopic image is to interleave the left and right eye views. The most common way is on alternating rows (this works with CRTs, shutter glasses and a VGA line blanker or a video card that can switch to an interlaced scanning mode). Some LCDs also use this pattern (alternating polarisation on odd/even lines), though I've heard of LCDs also using column or even chequerboard interleaving.

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!