Tuesday, September 25, 2007

3D stereo anaglyph view in WWJ

3D graphics are great, but stereo 3D is even better. Here is a quickly put together AnaglyphSceneController for WWJ. Is is to be used in place of the BasicSceneController from the SDK and will produce real time red/cyan anaglyphs whenever the view is pitched more than twenty degrees.


Download AnaglyphSceneController.java (updated sept 27) and add it to src.gov.nasa.worldwind - after removing the .txt extension. To use it, edit src.config.worldwind.properties and change the class name for the gov.nasa.worldwind.avkey.SceneControllerClassName entry:

gov.nasa.worldwind.avkey.SceneControllerClassName
=gov.nasa.worldwind.AnaglyphSceneController


Overall it works reasonably well considering the amount of code - its quite simple. However, the stereo effect tends to shift when the view is being moved or rotated, but it eventually settles down to the proper settings when you stop moving around.


You need red and cyan glasses (with the red filter on the left eye) to view those anaglyphs. Caution, you may quickly feel sick... reduce the focusAngle to 1.5 or 1 degree if the stereo separation is too sharp.

Enjoy the world in real 3D ;)

World Wind Java forum tread.

2 comments:

Anonymous said...

Sir,
how can i do this with photographs???? pls
k_kkotadia@yahoo.com

Patrick Murris said...

Simply take two pictures of the same scene by moving the camera 1/100th the distance to the subject - this emulates the view with two eye. Then you can assemble the two in an image editor: take the green and blue channels from the right view and the red channel from the left one. Align the two and try out with appropriate glasses. Do a search on "anaglyph", you should find more detailed instructions. It's very easy.