[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] free 3D glasses in some US grocery stores




On Jan 31, 2009, at 5:50 PM, Ian Mallett wrote:
The maths for this are simple.

In OpenGL it's extremely doable realtime as well.  3D effects work by parallax--the difference in position between your eyes.  In OpenGL, you can render the scene once in red, then again at an offset and in blue.  You can get a passable 3D effect this way.

I'd like to see some pygames with 3D.

Yes, for red-cyan type 3D glasses, it's trivially easy: take your scene, render from the left and the right in color, and then subtract all the red out of left view, and subtract all the green and blue (cyan) from the right eye view. Add them together, and put on the glasses with cyan (green-blue) lens over the left eye, red over the right eye. (If you have blue or green left eye, they will also work, but the color won't be as good.)

So for the ColorCode, render left and right in color, then subtract blue from the left eye view, and yellow (red+green) from the right eye view. Add them together, and then put the glasses on with left eye "brown" and right eye blue.

Gee, that was easier than I thought.