titanlab / fceugc

Automatically exported from code.google.com/p/fceugc
0 stars 0 forks source link

Stereoscopic 3D support for stereoscopic 3D games #317

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the enhancement desired or suggested change:

The PS3 now supports stereoscopic 3D in games designed for that, but so did the 
NES back in 1987.

Square, the makers of Final Fantasy, were the first to support it with red/cyan 
anaglyph glasses in the 3-D Battles of World Runner and the Japanese version 
Tobidase Daisakusen. 

After that, Nintendo released the Famicom 3D System, which were LCD shutter 
glasses that plugged into the Famicon's expansion port and were controlled by 
setting the pin OUT1 high for one eye and low for the other eye. There is no 
other input or output from the glasses (or at least none we need to worry 
about), and there is a pass-through for other expansions. It was not released 
outside Japan.

Rad Racer was released as Highway Star in Japan and it used the Famicom 3D 
System in Japan. In the USA it used red/cyan Anaglyph instead.

All the other stereoscopic 3D games were only released in Japan for use with 
the Famicom 3D system: JJ Tobidase Daisakusen II, Famicom Grand Prix II - 3D 
Hot Rally, Falsion, Cosmic Epsilon, and Attack Animal Gakuen.

All the stereoscopic games use the Select button to toggle stereoscopic 3D on 
and off.

Except Orb-3D which always uses the Pulfrich effect, by using a dark filter 
over the right eye so that the right eye sees an image from a few frames ago 
(dark images take longer for your brain to process) while the left eye sees the 
current frame.

By using a global variable to keep track of the state of the OUT1 pin (which 
isn't really used for anything else), and checking whether it is alternating 
each frame, I can detect when 3D mode has been entered, or exited, and which 
eye is currently rendering.

For the left eye, I just save a copy of the frame, and for the right eye I 
render a combined anaglyph image (which is generated while swizzling into a 
texture). This lowers the frame rate to 30Hz, so I change the function that 
handles the timing to always be used when in stereoscopic mode.

For the three (technically two) anaglyph games, they alternate fixed portions 
of the palette every frame, which I can detect, and do the exact same thing (my 
anaglyph doesn't flicker and uses correct anaglyph colours, so it works a 
hundred times better than theirs).

I've got it all working, except for Falsion which my eyes can't merge with the 
anaglyph (possibly because the position of all the sprites is modified every 
frame even when swapping eyes, and possibly because of the huge white on black 
contrast).

Also for all the games, when I exit 3D mode, the game runs at double speed. I 
can't work out why, since the code looks right.

I plan to add side-by-side output to be compatible with modern 3D TVs (which I 
don't have). And other Anaglyph modes. The Wii (like the GameCube) includes 
built-in support for stereoscopic 3D, but I can't work out how to implement it, 
or if it would be useful with any hardware.

I also plan to add Orb-3D support (without the need for Pulfrich glasses) by 
storing the last couple of frames and always using the oldest frame for the 
right eye's image.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by Carl.Kenner@gmail.com on 9 Dec 2010 at 10:02

GoogleCodeExporter commented 9 years ago
OK, I fixed the bug with the double speed.

Original comment by Carl.Kenner@gmail.com on 9 Dec 2010 at 12:10

GoogleCodeExporter commented 9 years ago

Original comment by dborth@gmail.com on 2 Jan 2011 at 8:37