11
Jun

Ever wanted to create a red-blue 3D picture from a 3D scan? I did. Figured it out too. This post describes how you could get something like this:

agt5

Except, probably much better looking. I’m using the Mephisto 1.6 Complete software in conjunction with 3D Studio Max 2009.

Click more, for more…

Firstly, I’m going to assume that you are taking a new scan. If you’d like colour images, then make sure you save the colors for each vertex (see the checkboxes when you scan). I’ve found that exporting in PLY format works well.

Next, you’ll need 3D Studio MAX to be able to read PLY format files. I’ve found that this free plugin deals with the Mephisto PLY output. There may be others (please comment).

So, with 3DS Max open, import your PLY scan data. I had something like this:

agt1

After cleaning up the unwanted parts of the model, changing the pivot point, and rotating to ensure the Top, Front and Left views made sense, I had this:

agt2

Next, we need to use the colour information stored with each vertex. Open the Material Editor, and working with a Default material, open up the Maps area. For the Diffuse Color, create a new Map by choosing ‘Vertex Color’ from the list. Assign this material to your scanned object. After rendering, it should have colour:

agt3

Next, we need a pair of target cameras, set at the right distance apart, and both pointing to exactly the same spot, somewhere in the middle of the model. Name the left camera lefteye and the right camera righteye. You can pick different names if you like, but the script I’ll use will rely on these names. The easiest method I’ve found is to create a camera at 0,0,0 , looking straight forward into the y axis. Then use move this using the move transform type-in to, say -3cm for the left eye, and +3cm for the right eye. This assumes your model’s units work out like this.

Here’s where we’re at, noting that we can view lefteye and righteye:

agt4

Finally, a script that will display an anaglyph using both cameras:
imgw = 1600
imgh = 1200

a = render camera:$lefteye outputwidth:imgw outputheight:imgh vfb:false
b = render camera:$righteye outputwidth:imgw outputheight:imgh vfb:false

c = bitmap imgw imgh

for j = 0 to imgh-1 do
(
for i = 0 to imgw-1 do
(
cleft = getpixels a [i,j] 1
cright = getpixels b [i,j] 1
cfinal = #([cleft[1].red, cright[1].green, cright[1].blue])
setpixels c [i,j] cfinal
)
)

display c

Select ‘New Script’ from the ‘MAXScript’ menu, paste the above in, and use CTRL-E to run it. You should get a single anaglyph image:

agt5