Tutorial for 3DTV apps on tvOS

As promised in another thread, I've written up a simple tutorial explaining how to do stereo-3D games for tvOS that should work on any HDTV with 3D capabilities. We put this capability into all of our tvOS games: Air Wings, Bugdom 2, Nanosaur 2, Otto Matic, and Nucleus. It literally took about 3 minutes per game to add it.


http://pangeasoft.net/iphone/3dtv/


If you have any suggestions or whatnot please let me know. This is a pretty basic tutorial, but I think it lays out what needs to be done and how to do it pretty well.


Enjoy!


-Brian

Thanks, Brian.

=

Ken

Beautiful stuff, thanks a lot for sharing this!

I was kinda hoping I could use this in my game, but I went with Scenekit + Metal so it's not so simple to add.

I'll do some testing though.

Yeah, I figured this might not be too helpful for people using 3rd party game engines, or higher level API's like SceneKit. The process is so simple, however, that I'd think the basic concept could be adapted to just about anything so long as you have the capability of rendering each frame twice.


-Brian

Hi can we get this working for the "classical" red / green glasses as well?

Doing this for anaglyph glasses only requires a few minor modifications. For starters, you draw both passes full-screen, obviously, so don't scale the viewport at all. Instead of drawing them side-by-side, you simply draw them on top of each other.


1. Only glClear() the color buffer at the beginning, but clear the z-buffer on both passes.

2. You mask each pass with the approprite color:


if (pass == 0)
     glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE);
else
     glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);


This will draw the first pass with red only. Then the 2nd pass gets drawn with green & blue only.


That is quite literally all there is to it. One other trick, however, is to do some fancy color manipulation on your textures in advance. There is often some color bleed between the red and green channels, so what we would do in our older anaglph games was to pre-scan all of our textures and reduce the green in all of them. We had some fancy algorithms for doing this properly, and some of the games even had calibration dialogs that let the user adjust the color shifting to match their particular monitor and/or anaglyph glasses.


-Brian

Amazing Brian! Thank you so much for sharing your Tutorial!

Thanks it is really cool! Wish to see games and apps with streaming 3d video working with anaglyph glasses as well!

By the way, if anyone needs to see the 3DTV stuff in action but doesn't want to have to buy an app then just download Air Wings - that one is free, so you can check out the 3DTV stuff without having to pay anything.


-Brian

Also working with anaglyph glasses?

Heh, no. Bugdom 2, Otto Matic, and Nanosaur 2 on the Mac all support the anaglphy glasses, but not the tvOS versions. TV's generally have really poor RGB separation, so the ghosting with the Red-Cyan method is horrible. The old Apple LCD displays back when those games were first made (early 2000's) the RGB separation was almost perfect. Around 2006 or so Apple changed LCD panels, and the new ones leaked green like crazy which pretty much ruined the 3D effect. Bottom line is that you have to have a really good monitor with very accurate and bleedless RGB for the anaglyph to work.


However, one option the Mac verions have is to do Anaglyph in Black & White instead of color. This works great because you can just use the Red and Blue channels and cut out the green entirely, so no bleed. To do this, however, you have to convert all of your textures to grayscale (in the code), and perform a luminance transformation on them so that the colors correctly map to gray. If anyone really cares, I can provide more info.


-Brian

Thanks for your detailled explanations. I am a big fan of 3d - unfortunately the TV here does not support it. Sure you are doing great work with it!!!

Tutorial for 3DTV apps on tvOS
 
 
Q