6.837-05 Transformations 2: In Modeling

Add to Favourites
Post to:

MIT EECS 6.837, Durand and Cutler Transformations in Ray TracingMIT EECS 6.837, Durand and Cutler Linear Algebra Review Session•Tonight!•7:30 –9 PMMIT EECS 6.837, Durand and Cutler Last Time:•Simple Transformations•Classes of Transformations•Representation–homogeneous coordinates•Composition–not commutativeMIT EECS 6.837, Durand and Cutler Today•Motivations•Transformations in Modeling•Adding Transformations to our Ray Tracer•Constructive Solid Geometry (CSG)•Assignment 2MIT EECS 6.837, Durand and Cutler Modeling•Create /acquire objects•Placing objects•Placing lights•Describe materials•Choose camera position and camera parameters•Specify animation•....MIT EECS 6.837, Durand and Cutler Transformations in Modeling•Position objects in a scene•Change the shape of objects•Create multiple copies of objects•Projection for virtual cameras•AnimationsMIT EECS 6.837, Durand and Cutler Today•Motivations•Transformations in Modeling–Scene description –Class Hierarchy–Transformations in the Hierarchy•Adding Transformations to our Ray Tracer•Constructive Solid Geometry (CSG)•Assignment 2MIT EECS 6.837, Durand and Cutler Scene DescriptionSceneLightsCameraObjectsMaterials(much more next week)BackgroundMIT EECS 6.837, Durand and Cutler Simple Scene Description FileOrthographicCamera {center 0 0 10direction 0 0 -1up 0 1 0size 5 }Lights {numLights 1DirectionalLight {direction -0.5 -0.5 -1color 1 1 1 } }Background { color0.2 0 0.6 }Materials {numMaterials }Group { numObjects }MIT EECS 6.837, Durand and Cutler Class HierarchyCylinderGroupPlaneSphereConeTriangleObject3DMIT EECS 6.837, Durand and Cutler Why is a Group an Object3D?•Logical organization of sceneMIT EECS 6.837, Durand and Cutler Simple Example with GroupsGroup { numObjects3Group {numObjects3Box { }Box { }Box { } }Group {numObjects2Group {Box { }Box { }Box { } }Group {Box { }Sphere { }Sphere { } } }Plane { } }MIT EECS 6.837, Durand and Cutler Adding MaterialsGroup { numObjects3Group {numObjects3Box { }Box { }Box { } }Group {numObjects2Group {Box { }Box { }Box { } }Group {Box { }Sphere { }Sphere { } } }Plane { }}MIT EECS 6.837, Durand and Cutler Adding MaterialsGroup { numObjects3Material { }Group {numObjects3Box { }Box { }Box { } }Group {numObjects2Material { }Group {Box { }Box { }Box { } }Group {Material { }Box { }Material { }Sphere { }Material { }Sphere { } } }Material { }Plane { } }MIT EECS 6.837, Durand and Cutler Adding TransformationsMIT EECS 6.837, Durand and Cutler Class Hierarchy with TransformationsObject3DCylinderGroupPlaneSphereConeTriangleTransformMIT EECS 6.837, Durand and Cutler Why is a Transform an Object3D?•To position the logical groupings of objects within the sceneMIT EECS 6.837, Durand and Cutler Simple Example with TransformsGroup { numObjects3Transform {ZRotate{ 45 }Group {numObjects3Box { }Box { }Box { } } }Transform { Translate { -2 0 0 }Group {numObjects2Group {Box { }Box { }Box { } }Group {Box { }Sphere { }Sphere { } } } }Plane { } }MIT EECS 6.837, Durand and Cutler Nested Transformsp' = T ( S p ) = TS pTranslateScaleTranslateScalesame asSphereSphereTransform {Translate { 1 0.5 0 }Scale { 2 2 2 }Sphere { center0 0 0 radius 1 } } Transform {Translate { 1 0.5 0 }Transform {Scale { 2 2 2 }Sphere { center0 0 0 radius 1 } } } MIT EECS 6.837, Durand and Cutler Questions?MIT EECS 6.837, Durand and Cutler Today•Motivations•Transformations in Modeling•Adding Transformations to our Ray Tracer–Transforming the Ray–Handling the depth, t–Transforming the Normal •Constructive Solid Geometry (CSG)•Assignment 2MIT EECS 6.837, Durand and Cutler Incorporating Transforms1.Make each primitive handle any applied transformations2.Transform the RaysTransform {Translate { 1 0.5 0 }Scale { 2 2 2 }Sphere { center0 0 0 radius 1 } } Sphere { center1 0.5 0 radius 2 } MIT EECS 6.837, Durand and Cutler Primitives handle Transformsrmajorrminor(x,y)Sphere { center3 2 0 z_rotation 30r_major 2r_minor 1 } •Complicated for many primitivesMIT EECS 6.837, Durand and Cutler Transform the Ray•Move the ray from World Spaceto Object Spacermajorrminor(x,y)(0,0)Object SpaceWorld Spacer = 1pWS= MpOSpOS= M-1pWSMIT EECS 6.837, Durand and Cutler Transform Ray•New origin:•New direction:originOS= M-1originWSdirectionOS= M-1(originWS+ 1 * directionWS) -M-1originWSoriginOSoriginWSdirectionOSdirectionWSObject SpaceWorld SpaceqWS= originWS+ tWS* directionWSqOS= originOS+ tOS* directionOSdirectionOS= M-1directionWSMIT EECS 6.837, Durand and Cutler Transforming Points & Directions•Transform point•Transform directionHomogeneous Coordinates: (x,y,z,w)W = 0is a point at infinity (direction)MIT EECS 6.837, Durand and Cutler What to do aboutthe depth, tIf Mincludes scaling, directionOSwill NOT be normalized1.Normalize the direction 2.Don't normalize the directionMIT EECS 6.837, Durand and Cutler 1. Normalize direction•tOS≠tWSand must be rescaled after intersectionObject SpaceWorld SpacetWStOSMIT EECS 6.837, Durand and Cutler 2. Don't normalize direction•tOS=tWS•Don't rely on tOSbeing true distance during intersection routines (e.g. geometric ray-sphere intersection, a≠1 in algebraic solution)Object SpaceWorld SpacetWStOSMIT EECS 6.837, Durand and Cutler Questions?MIT EECS 6.837, Durand and Cutler New component of the Hit class•Surface Normal: unit vector that is locally perpendicular to the surfaceMIT EECS 6.837, Durand and Cutler Why is the Normal important?•It's used for shading —makes things look 3D!Diffuse Shading (Assignment 2)object coloronly (Assignment 1)MIT EECS 6.837, Durand and Cutler Visualization of Surface Normal±x= Red±y= Green±z= Blue MIT EECS 6.837, Durand and Cutler How do we transform normals?Object SpaceWorld SpacenWSnOSMIT EECS 6.837, Durand and Cutler Transform the Normal like the Ray?•translation?•rotation?•isotropic scale?•scale?•reflection?•shear?•perspective? MIT EECS 6.837, Durand and Cutler Transform the Normal like the Ray?•translation?•rotation?•isotropic scale?•scale?•reflection?•shear?•perspective?MIT EECS 6.837, Durand and Cutler What class of transforms?SimilitudesTranslationRotationRigid /EuclideanLinearAffineProjectiveSimilitudesIsotropic ScalingScalingShearReflectionPerspectiveIdentityTranslationRotationIsotropic ScalingIdentityReflectiona.k.a. Orthogonal TransformsMIT EECS 6.837, Durand and Cutler Transformation for shear and scaleIncorrectNormalTransformationCorrectNormalTransformationMIT EECS 6.837, Durand and Cutler More Normal VisualizationsIncorrect Normal TransformationCorrect Normal TransformationMIT EECS 6.837, Durand and Cutler So how do we do it right?•Think about transforming the tangent plane to the normal, not the normal vectorOriginalIncorrectCorrectnOSPick any vector vOSin the tangent plane,how is it transformed by matrix M?vOSvWSnWSvWS= MvOSMIT EECS 6.837, Durand and Cutler Transform tangent vector vvis perpendicular to normal n:nOSTvOS= 0nOST(M-1M)vOS= 0nOSvOS(nOSTM-1) (MvOS) = 0(nOSTM-1)vWS= 0vWSis perpendicular to normal nWS:nWST=nOS(M-1)nWSTvWS= 0nWS=(M-1)TnOSnWSvWSMIT EECS 6.837, Durand and Cutler Comment•So the correct way to transform normalsis:•But why did nWS= MnOSwork for similitudes?•Because for similitude /similarity transforms,(M-1)T=λM•e.g. for orthonormalbasis:nWS=(M-1)TnOSuxvxnxuyvynyuzvznzxuyuzuxvyvzvxnynznM =M-1 =MIT EECS 6.837, Durand and Cutler Questions?MIT EECS 6.837, Durand and Cutler Today•Motivations•Transformations in Modeling•World Space vsObject Space•Adding Transformations to our Ray Tracer•Constructive Solid Geometry (CSG)•Assignment 2MIT EECS 6.837, Durand and Cutler Constructive Solid Geometry (CSG)Given overlapping shapes A and B:Union Intersection SubtractionMIT EECS 6.837, Durand and Cutler How can we implement CSG?Union Intersection SubtractionPoints on A, Outside of BPoints on B, Outside of APoints on B, Inside of APoints on A, Inside of BMIT EECS 6.837, Durand and Cutler Collect all the intersectionsUnion Intersection SubtractionMIT EECS 6.837, Durand and Cutler Implementing CSG1.Test "inside" intersections:•Find intersections with A, test if they are inside/outside B•Find intersections with B,test if they are inside/outside A2.Overlapping intervals:•Find the intervals of "inside"along the ray for A and B•Compute union/intersection/subtractionof the intervalsMIT EECS 6.837, Durand and Cutler "Fredo'sFirst CSG RaytracedImage"MIT EECS 6.837, Durand and Cutler Questions?MIT EECS 6.837, Durand and Cutler Today•Motivations•Transformations in Modeling•World Space vs ObjectSpace•Adding Transformations to our Ray Tracer•Constructive Solid Geometry (CSG)•Assignment 2–Due Wednesday Sept 24th, 11:59pmMIT EECS 6.837, Durand and Cutler Simple Shading•Single Directional Light Source•Diffuse Shading•Ambient Lightndirlightcpixel= cambient*cobject+ dirlight•n *clight*cobjectclight=(1,1,1)cambient= (0,0,0)clight=(0.5,0.5,0.5)cambient= (0.5,0.5,0.5)MIT EECS 6.837, Durand and Cutler Adding Perspective CamerahorizontalangleupdirectionMIT EECS 6.837, Durand and Cutler Triangle Meshes (.obj)v -1 -1 -1v 1 -1 -1 v -1 1 -1 v 1 1 -1 v -1 -1 1 v 1 -1 1 v -1 1 1 v 1 1 1 f 1 3 4 f 1 4 2 f 5 6 8 f 5 8 7 f 1 2 6 f 1 6 5 f 3 7 8 f 3 8 4 f 1 5 7 f 1 7 3 f 2 4 8 f 2 8 6verticestrianglesMIT EECS 6.837, Durand and Cutler Acquiring Geometry•3D Scanning(Images removed due to copyright considerations.)MIT EECS 6.837, Durand and Cutler Next Week:Ray TracingSurface reflectance

Description
In this lecture notes we are going to continue with tranformations . The topics covered in this particular lecture notes are Transformations in Modeling, Adding Transformations to our Ray Tracer and Constructive Solid Geometry (CSG).

“Prof. Frédo Durand & Prof. Barbara 6.837-05 , Transformations 2: In Modeling , 6.837 Computer Graphics ,Electrical Engineering and Computer Science, Engineering, Massachusetts Institute of Technology: MIT Open Course Ware,http://ocw.mit.edu (22-08-2011).License: Creative Commons BY-NC-SA: http://ocw.mit.edu/terms/#cc".

Comments

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no:


Area code Number
Subjects you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy
LearnOnline Through OCW
OpenCourseWare
User
102 Followers

Your Facebook Friends on WizIQ

Explore Similar Courses

Give live classes, create & sell online courses

Try it free Plans & Pricing

Connect