Home :: Login :: Forgot Password :: Search :: FAQ
Support our host

News

Software

Reference

Community

Parts Library

About Us

Reference > Tutorials
Published By SharkD on Sunday, December 28, 2008 - 09:59 AM

Printer-friendly page

Polarized Glasses Tutorial
By: Michael Horvath

Introduction: This tutorial describes how to render LDraw models so that they can be viewed in 3D using polarized glasses. Before proceeding with this tutorial, you should already know how to build models using MLCad and convert them to POV-Ray format using L3P.

Background: Polarized glasses are a type of glasses that affect depth-perception by intercepting light in such a way that two-dimensional images appear three-dimensional to the eye. The perceived depth depends on the wavelength of the reflected light; blueish colors appear to be distant, redder colors appear to be near, greener colors appear to lie somewhere in the middle.

One manufacturer of such glasses is ChromaTek. You can learn more about their glasses by visiting their website. For more information on polarized glasses in general, you can read the Open CyberHolographic Standard (also located at the ChromaTek website).

Instructions:

  1. Convert your MLCAD model to POV-Ray format using L3P. Open the POV file in POV-Ray. Search within the file for light source statements (they should be near the end of the file) and delete any that you encounter.

  2. Locate the camera statement. It should be just above the lights, before the background, and should look something like this:

    // Camera (Latitude,Longitude,Radius = 30,45,-20)
    camera {
    	#declare PCT = 20; // Percentage further away
    	#declare STEREO = 0; // Normal view
    	//#declare STEREO =  degrees(atan2(1,12))/2; // Left view
    	//#declare STEREO = -degrees(atan2(1,12))/2; // Right view
    	location vaxis_rotate(<607.219,-575.974,-744.326> 
    		+ PCT/100.0*<542.276,-442.766,-542.276>,
    		<-240101,-588126,240101>, STEREO)
    	sky      -y
    	right    -4/3*x
    	look_at  <64.9436,-133.208,-202.05>
    	angle    67.3801
    }
  3. Move the camera statement to the very top of the file, and insert the following code immediately after it:

    #declare lookFrom = ;
    #declare lookAt = ;
    #declare ChromaMaterial = #if (version >= 3.1) material { #end texture {
    	pigment {
    		gradient vnormalize(lookFrom – lookAt)
    		color_map { [0 rgb z][1/2 rgb y][1 rgb x] }
    		scale vlength(lookFrom - lookAt) * 2
    		translate lookFrom * -1
    	}
    	finish {ambient 1}
    } #if (version >= 3.1) } #end
  4. Look within the camera statement for the location and look_at keywords. Copy the part following the location keyword and paste it after the lookFrom keyword. Now, copy the part that follows the look_at keyword and paste it after the lookAt keyword. When you're done, it should look something like this:

    #declare lookFrom = vaxis_rotate(<607.219,-575.974,-744.326>
    				+ PCT/100.0*<542.276,-442.766,-542.276>,
    				<-240101,-588126,240101>, STEREO);
    #declare lookAt = <64.9436,-133.208,-202.05>;
  5. Search for the very last object statement. It should be near the end of the POV file, just before the background statement. If the name of your model file is "castle.ldr", then the object statement should look something like this:

    object { castle #if (version >= 3.1) material #else texture #end { Color7 } }
  6. Modify the code so that the ChromaMaterial material is used instead of Color(n). E.g.:

    object { castle #if (version >= 3.1) material #else texture #end { ChromaMaterial } }
  7. Now, search within the POV file for any other instances of a Color(n) texture being assigned to an object, and delete them. For example, if you find a line like this, delete it:

    #if (version >= 3.1) material #else texture #end { Color8 }
  8. You're finished! All you have to do now is render your image. The final rendered image should look something like this:

Note: Trim whitespace a bit.



Recipient 2009
Tim Courtney

Want to learn more about LDraw? Check out the following books:




Current Contest Winners

Model of the Month


Scene of the Month


Part of the Month - Best Part


Part of the Month - Most Desired Part



Vote for Next Month's Winner

Submit Your Creation for Next Month's Contest

What's new in lugnet.cad?

Re: SR 3D Builder 0.4.5.8
by Sergio Reano - 6 hours ago

Re: Belville Basket & Bucket Handle
by Michael Heidemann - 6 hours ago

Belville Basket & Bucket Handle
by Cristian Sala - 7 hours ago

Re: SR 3D Builder 0.4.5.8
by Michael Heidemann - 12 hours ago


There are 41 unlogged users and 0 registered users online.

You can log-in or register for a user account here.





 


 Log in Problems?
 New User? Sign Up!

©2003-2010 LDraw.org, see Legal Info for details.
LDraw™ is a trademark owned and licensed by the Estate of James Jessiman
This website is powered by Peeron.com.

LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this site. Visit the official Lego website at http://www.lego.com.
LDraw is a completely unofficial, community run free CAD system which represents official parts produced by the LEGO company.