OSU CS 519 - Creating More Realistic Lens Effects

Unformatted text preview:

1Creating More Realistic Lens EffectsMike BaileyOregon State Universitymjb – April 30, 2007P?Convex Lens DefinitionsCenter1Center2R2(>0)R1(>0)PEye-Zmjb – April 30, 20072P?Concave Lens DefinitionsCenter2Center1R1(<0)R2(<0)PEye-Zmjb – April 30, 2007varying vec3 RefractVector;uniform float R1, R2;. . .const float ETA_RATIO = 0.66;vec3 P=vec3( gl ModelViewMatrix*gl Vertex );-ZEyev1lens.vert – Setup for a Cube Map TexturePvec3 P vec3( gl_ModelViewMatrix gl_Vertex );vec3 Eye = vec3( 0., 0., 0. );vec3 FromEyeToPt = normalize( P - Eye ); // vector from eye to ptvec3 Center1 = vec3( 0., 0., P.z - R1 );vec3 Normal1;if( R1 >= 0. )Normal1 = normalize( P - Center1 );elseNormal1 = normalize( Center1 - P );vec3 v1 = refract( FromEyeToPt, Normal1, ETA_RATIO ); // eta ratio = in/outv1 = normalize( v1 );zero thicknessmjb – April 30, 2007vec3 Center2 = vec3( 0., 0., P.z + R2 );vec3 Normal2;if( R2 >= 0. )Normal2 = normalize( Center2 - P );elseNormal2 = normalize( P - Center2 );RefractVector = refract( v1, Normal2, 1./ETA_RATIO );gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;3v1P-ZEyezero thicknessmjb – April 30, 2007Convex Lenses (R1>0, R2>0)mjb – April 30, 20074Convex Lenses (R1>0, R2>0)mjb – April 30, 2007Concave Lenses (R1<0,R2<0)mjb – April 30, 20075mjb – April 30,


View Full Document

OSU CS 519 - Creating More Realistic Lens Effects

Download Creating More Realistic Lens Effects
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Creating More Realistic Lens Effects and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Creating More Realistic Lens Effects 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?