Stereoscopic 3D Glasses Tutorial
Introduction
Stereoscopic imaging works on the principle that each eye sees a slightly altered image, which are then combined in our mind to form a 3D mental picture. In photography, this is accomplished by moving two cameras slightly apart from each other to simulate the distance separating our eyes, and then taking two photographs. However, stereoscopic images can also be created using a program like POV-Ray. In this tutorial I will explain how to render and display stereoscopic images of LDraw models using LDView and POV-Ray, as well as a special stereo image program called StereoPhoto Maker and a cheap stereoscope you can purchase on Amazon.
Instructions
Step 1: Using MLCAD and LDView
The first thing you want to do is create your LDraw model in MLCad, LDCad, or whatever 3D modeler you prefer. When you are done, load your model in LDView and position your camera where you intend to view the scene from. In my case, I used the default camera orientation. When your camera is positioned properly, go to the "File > Export..." dialog, and export your model to a POV-Ray file. Again, I used the default settings, but you can change them to whatever you want to increase the render quality and so forth.
Step 2: Using POV-Ray
Once you've exported your model in LDView, you should open the file in POV-Ray. If you are using POV-Ray version 3.7 and LDView version 4.1, the first thing you will want to do is insert the following code at the top of the file. Otherwise, the colors will all be messed up. Future versions of LDView may not suffer cause this problem.
#version 3.6
Once you have inserted the above code, scroll down to the section labeled "camera" and replace the camera code block with the following.
// Camera #ifndef (LDXSkipCamera) #declare camera_eye = 1; // -1 = no eye, 0 = left eye, 1 = right eye #declare LDXCamAspect = image_width/image_height; camera { location LDXCameraLoc sky LDXCameraSky right LDXCamAspect * < -1,0,0 > look_at LDXCameraLookAt angle 57.822403 #switch (camera_eye) #case (0) #include "transforms.inc" translate -LDXCameraLookAt Axis_Rotate_Trans(y, +5/2) translate +LDXCameraLookAt #break #case (1) #include "transforms.inc" translate -LDXCameraLookAt Axis_Rotate_Trans(y, -5/2) translate +LDXCameraLookAt #break #end } #end
Note the variable named "camera_eye". This variable controls which "eye" is being simulated. 0 means the left eye, 1 means the right eye. For now, leave this variable set to 0.
To get good results, you want to render your image at a very high resolution. Each output image needs to be roughly 3 inches wide and 3 inches tall, and a dpi (dots-per-inch) value of 1200 is a good target when printing on most home inkjet printers. Therefore, you want to render at 3600 x 3600 pixels (1200 dpi multiplied by 3 inches = 3600 dots or pixels).
Since 3600 pixels by 3600 pixels is not one of the default output image resolutions, you will have to either edit the POV-Ray INI file, or type some extra command-line options into the POV-Ray input bar. For the sake of brevity, I will ignore editing the INI file, and instead tell you to type the following into the input bar.
+W3600 +H3600
Again, there are additional command-line options you may want to use to improve the quality of the output image, but I will leave those for you to discover on your own.
You are now ready to render the first image. Click the "Run" button to render the image corresponding to the left eye. This may take several minutes.
When POV-Ray has finished rendering, locate the output image in whatever folder you specified as the output directory. (I am not going to explain how to do that.) When you have located the output image, rename the file by appending the string "_Left" to the end of the file name.
Now, in POV-Ray, locate the "camera_eye" variable again and this time set it to 1 instead of zero. This means you will now be rendering the image for the right eye. Save and render the document. When POV-Ray is done rendering, locate the new output file and rename it by appending the string "_Right" to the end of the file name. You are now ready to process the output images in StereoPhoto Maker.
Step 3: StereoPhoto Maker
StereoPhoto Maker is a freeware program designed to process left and right eye photographs and images into stereoscopic and anaglyph 3D images. You can download it from the Web. (I can't post a URL here since the wiki software is blocking me.) If you have anaglyph or red-cyan 3D glasses, you will want to create an anaglyph image. If you have a stereoscope, you will want to output a stereoscopic image. I recommend the latter since it will not mess up the image's colors like an anaglyph image will.
Once you have downloaded and installed StereoPhoto Maker, start the program and open the "File" menu and select "Open Left/Right Images...". This will open a dialog where you can locate the "Left" and "Right" images you rendered in POV-Ray. Once you have located them, select the "Left" image and while, pressing the CTRL key on your keyboard, select the "Right" image.