Making 3D anaglyph images using Cinema 4D

From NoskeWiki
Jump to: navigation, search

About

Stereoscopy is a method for creating the illusion of depth in an image by presenting two offset images separately to the left and right eye of the viewer. Anaglyph images are stereoscopic images which look 3D when viewed with colored (typically red and cyan) glasses. Although anaglyph images lose color information and thus are not an ideal form of stereoscopy, the red and blue paper glasses are very cheap to produce and anaglyph images remain in occasional use in fields such as science. Using a graphics program like Adobe Photoshop it's quite easy to take two slightly offset images - one representing the left eye and one representing the right eye - overlap them and remove certain color channels in one image to create an anaglyph. In photography one can take two images from slightly different positions, but here we talk about how to create an anaglyph image and anaglyph movie from the 3D animation package Cinema 4D. The three lessons on this page are:

  1. Making stereo pair images in Cinema 4D
  2. Combining two images into a 3D anaglyph using Adobe Photoshop
  3. Making a 3D anaglyph movie using Cinema 4D and QuickTime


NOTE: This page is a daughter page of: Cinema 4D


(1) Making stereo pair images in Cinema 4D

To create a pair of stereographic image we need to take two images from slightly offset cameras. First however we need to setup our scene with some objects:

  • Open Cinema 4D
  • Add a sphere via: menubar > Object > Primitives > Sphere.
  • Now you can add and move around several more spheres, but if using a recent version like Cinema 4D R12 we can make a complex structure quickly using an "atom array". Click: Object > Modeling > Atom Array and then, within the Object window make Sphere a child of the Atom Array.
  • Create a new directory on your desktop called my_first_anaglyph and save your file as anaglyph_scene.c4d.


Now our 3D scene is setup we must make our left and right eye cameras:

  • Zoom into a good distance using the mouse wheel.
  • Create your first camera with Object > Scene > Camera and then rename this camera "left_eye"
  • Create a second camera using the same method and call it "right_eye".
  • Make "right_eye" a child of "left_eye", and in the Attributes window set its X value is set to 50 units and all other parameters set to 0.
    • NOTE: 50 mm is the approximate distance between a human's eyes.
    • TIP: If you scene is at a funny scale you may want space your eyes apart by about 1/30 th the distance from the cameras to the front-most object.
  • The reason for making one eye a child of the other is so that the right eye will remain in a constant position to the left where-ever we move and/or animate the left. The important thing is that you don't want to accidentally move "right_eye" - you only want to move the parent eye.
    • TIP: To prevent any accidental adjustments to the "right_eye" camera you can use the "Protection tag". Right click the "right_eye" in the Object window then click CINEMA 4D Tags > Protection.
Setting up your objects and camera in Cinema 4D

Our cameras now exist, but we now need to render them.

  • In the main menubar click: Render > Render Settings. In the render settings window select the "Output" tab and change the size preset to 800x600.
  • In the main viewport window select Cameras > Scene Cameras > left_eye to see the view from the left eye.
  • Click: Render > Render to Picture Viewer or press [shift+r] to render the image from the currently active camera. In the Picture Viewer Window click File > Save As and save your file as left_eye.tif into your folder.
  • In the main viewport window select Cameras > Scene Cameras > right_eye to see the view from the left eye and repeat the step above to create right_eye.tif.

The two images you just saved: "left_eye.tif" and "right_eye.tif" represent your two stereo pair images of your scene taken using your "left_eye" and "right_eye" camera objects.

ADVANCED TIP:
Here we have done things the "easy way", and the image isn't bad, but because our eyes are parallel, it will be slightly blurry. To give you image focus you must change the angle of the eyes to converge on the same point (the focal point). Rather than change rotations manually, a better way to do this is to make both cameras "target cameras" and give them the same "Null Object" as their "target", so that they focus on this point. Instructions on how to do this are here.


(2) Combining two images into a 3D anaglyph using Adobe Photoshop

Once you have your two stereo pair images you can turn them into an anaglyph using Adobe Photoshop with the following instructions.

  • Open "left_eye.tif" in Photoshop.
  • Next we want to add "right_eye.tif" as the second layer in Photoshop. The slower approach to doing this is: open right_eye.tif in Photoshop, then select and copy the whole image by pressing [ctrl+a] then [ctrl+c]. Now close this image and with your left_eye open click [ctrl+v] to paste this as a new layer on top.
    • TIP: As a quicker alternative, most version of Photoshop should allow you to select right_eye.tif in your file explorer, then drag this file ONTO the left_eye image within Photoshop and hit [Enter].
  • In the "Layers" panel (toggle this with [f7]) you should now see two layers. Right click the top ("right_eye") layer and select "Blending Options".
  • In the "Layer Style" window under "Blending Options" and "Advanced" blending uncheck the "R" channel so that only the "G" and "B" are left on then click Ok.
  • Select the bottom layer and click the lock button to unlock it.
  • Right click the bottom layer, chose "Blending Options" and turn off the "G" and "B" channels so that only the "R" is left on (for the left eye).
  • Find an put on a red and cyan glasses. Red should be over the left eye and if you don't have glasses already some easy instructions are here.
Creating an anaglyph in Photoshop using two layers with "Blending Options" on the top one


You should now see the classic "anaglyph" image such as the one below. What we did is changed the top layer to only display the red channel, such that we can only see the green and blue (together making cyan) channels from the top layer, and only the red channel of the layer underneath. Before you save this image, you might first want to play around with the alignment. Our eyes never really points parallel to each other - they focus in on an object in the foreground, so to make this a little more realistic, we can move around the top layer:

  • Select the top layer and click the "Move tool [V]" in the toolbar.
  • Use the left and right arrow keys to adjust the top image until you see a minimum amount of red over the object you want most in focus. In our C4D example, try to minimize the blurriness around the front-most ball.
  • Use your 3D glasses and move your head from side to side to check the effect. Notice if you move the images too far apart it will be difficult for your eyes to stay in focus.
  • Finish by using the crop tool to crop the image to remove the bits on the left and right where only one layer appears.
  • Use File > Save As to save the image as "my_first_anaglyph.tif".
Final anaglyph in Photoshop after alignment


(3) Making a 3D anaglyph movie using Cinema 4D and QuickTime

You've now seen how to turn a single picture into an anaglyph... what about a whole movie though?! One trick we could do is save all the frames from both eyes and use Photoshop to covert them all... but movies are typically thousands of frames per minute (30 frames/sec = 1800 frames/minute), so even if we wrote a good script the number of files is a bit unmanageable. Here I've discovered my own method to use Cinema 4D's "Color Correction" render setting together with QuickTime Pro to allow you to turn your C4D movie into an stereoscopic movie using minimal number of files.


If not already, lets create some animation in our C4D scene:

  • Select the "Atom Array" object at frame one, then click: Animation > Record Active Object [F9] to make your first keyframe.
  • Drag the timeline to frame 90.
  • In the "Attributes" panel, change the Atom Array's "P" rotate value to 180 degrees. Hit [F9] to make a second keyframe.
  • Hit the play button or Animation > Play Forwards [F8] to preview the animation.
    • NOTE: If you're feeling adventurous you can also move this object towards the camera, or move the camera itself by making keyframes for "left_eye"


With animation in place, we now have to do some special rendering tricks.

  • Open the render settings again with: Render > Render Settings. Slick the "Render Settings" button and click new.
  • Rename the newly added settings to "Left_eye_movie".
  • Making sure the "Left_eye_movie" is selected, go to the "Output", change the size to "640x480" (larger if you want) and then change the "frame range" from "current frame" to all frames.
  • Select the "Save" tab, and then change the format to "QuickTime Movie". To make it save, type "left_eye.mov" as the "file".
  • Click the "Effects" button and add the"Color Correction". Uncheck the red component so only green and blue are left.
  • Now click the "Render Settings" button and click "new child". Rename this new child "Right_eye_movie". With the new child selected, change the Color Correction so that green and blue are off and only red is on (chromatically opposite values from the other eye) and change the "Save > file name" to "right_eye.mov".
    • NOTE: Since this is a child render setting, the movie format and size properties should be the same as (inherited) as the parent so we shouldn't have to change these.
  • Finally, make sure you change set the "Left_eye_movie" as the active render settings to make sure you check the little white target crosshair just left of its tab. Close the render settings.
  • In the Objects window set the "Left_eye" camera as the currently active camera by clicking the white target crosshair just to the right of it.
  • With the main viewport now set to the "Left_eye", click the Render to Picture Viewer icon (or Render > Render to Picture Viewer) and it will render the animation as a quicktime movie saved as "left_eye.mov". You'll notice the movie looks aqua / cyan in color.
  • Change the currently active camera to "Right_eye". Under Render > Render Settings, change to your "Right_eye_movie" settings and repeat to render the right_eye camera to "right_eye.mov". You'll notice this second movie is very red.  :)
Setting up "Color Correction" render settings Cinema 4D


We've now rendered out two movies with different channels showing, but to combine then we'll use QuickTime. Notice that you'll need to have QuickTime pro to allow movie editing features.

  • Open "right_eye.mov" in QuickTime Pro then click [ctrl+a] then [ctrl+c] to select all frames and then copy them.
  • Close "right_eye.mov".
  • Open "left_eye.mov" (in QuickTime Pro) then click Window > Show Movie Properties
  • Click Edit > Add to Selection & Scale and notice in the Properties window there should now be two video tracks, with the (red) right eye now on top and the one underneath hidden.
  • In the Properties window, select "Video Track 2" and under "Visual Settings" tab change the "Transparency" to "Blend".
  • You should now see a anaglyph image and you can scrub back and forward to see your animation while wearing your glasses.
  • Click File > Save as to save this my_first_anaglyph_movie.mov.
Set the blend setting in Quicktime


Congratulations, you've just made your first 3D anaglyph movie. As a couple of tips: first you'll notice that your final movie is twice the size of the other two movies, since it contains two tracks. To make a smaller movie you can click: "File > Export" and this should produce a smaller movie which is flattened and compressed. A final tip is that you may want to be fancy in C4D with focussing both eyes onto the same point (rather than parallel). To do this you should add to "Target Cameras" instead of regular Cameras and make sure you give both the same target under "Attributes window > Target".


Conclusion

Anaglyphs is not the most sophisticated option for 3D, but still a cool trick to know for people who may want so show off a 3D image on a poster using some cheap and easy to make red-cyan paper frame glasses. Something to keep in mind however, is that some colors will look better than others, so it pays to play around with colors before committing to printing the final poster and/or rendering your final 3D movie. The strategies above are not the only methods for making anaglyphs, so if you know any other strategies don't hesitate to contact me at andrew.noskeATSIGNgmail.com.

Regards, Andrew.


Acknowledgements: I'd also like to thank "Captain 3D" for his article which helped quite a bit.


See Also


Links