Stereoscopic 3D Glasses Tutorial

From LDraw.org Wiki
Revision as of 12:29, 21 January 2016 by Michael Horvath (talk | contribs) (Created page with "==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 p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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