Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.

Slides:



Advertisements
Similar presentations
3D Transformations Assist. Prof. Dr. Ahmet Sayar
Advertisements

Computer Graphics: 3D Transformations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Computer Graphics Lecture 4 Geometry & Transformations.
CMPE 466 COMPUTER GRAPHICS
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
Computer Graphics with OpenGL 3e
2IV60 Computer Graphics 2D transformations
2D Transformations x y x y x y. 2D Transformation Given a 2D object, transformation is to change the object’s Position (translation) Size (scaling) Orientation.
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformation of Graphics
Transformations Dr. Amy Zhang.
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
2D Transformation of Graphics
Geometric Transformations Jehee Lee Seoul National University.
2D Geometric Transformations
Part7: Geometric Transformations
Geometric Transformations
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
1 Computer Graphics Week9 -3D Geometric Transformation.
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 1 1.
Computer Graphics 3D Transformations. Translation.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Two-Dimensional Geometric Transformations A two dimensional transformation is any operation on a point in space (x, y) that maps that point's coordinates.
Geometric Transformations
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
In the name of God Computer Graphics.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
Composing Transformations
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Homogeneous Coordinates and Matrix Representations Cartesian coordinate (x, y, z) Homogeneous coordinate (x h, y h, z h, h) Usually h = 1. But there are.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Computer Graphic 2 D Transformation.
CSCE 441 Computer Graphics: 2D Transformations
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
Rendering Pipeline Fall, 2015.
In the name of God Computer Graphics.
3D Geometric Transformation
2D Transformations By: KanwarjeetSingh
2D Geometric Transformations
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
Review: Transformations
3D Transformation.
Computer Graphics Lecture 18 3-D Transformations-II Taqdees A
Computer Graphics 3D Transformations
Computer Graphics Transformations.
Review: Transformations
Three-Dimensional Graphics
Line and Character Attributes 2-D Transformation
Three Dimensional Viewing
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Geometric Transformations for Computer Graphics
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Three-Dimensional Graphics
CSCE441: Computer Graphics 2D/3D Transformations
TWO DIMENSIONAL TRANSFORMATION
Presentation transcript:

Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics

Graphics Rendering Pipeline Rendering: conversion from scene to image Scene is represented as a model composed of primitives. Model is generated by a program or input by a user. Image is drawn on an output device: monitor, printer, memory, file, video frame. Device independence. 3D Scene 2D Image

Graphics pipeline Typically rendering process is divided into steps called the graphics/rendering pipeline. Ray tracing – Model your scene in WCS – Generate rays – Find pixel color by an Illumination/Shadow/Reflection model

Ray Tracing Pipeline

Forward Projection Pipeline

Forward projection pipeline Model M1 M2 M3 3D World Scene 3D View Scene V P Clip Normalize 2D/3D Device Scene 2D Image Projection Rasterization Modeling Transformations Viewing Transformations MCS WCS VCS NDCS DCS SCS

Modeling Transformation Model coordinates to World coordinates: World coordinates: All shapes with their absolute coordinates and sizes. z world x world y world

3D Viewing-Coordinate Parameters World coordinates to Viewing coordinates: Viewing transformations World coordinates Viewing coordinates: Viewers (Camera) position and viewing plane. z world x world y world x view y view z view

Basic Geometric Transformations Geometric transformations are used to transform the objects and the camera in a scene (for animation or modelling) and are also used to transform World Coordinates to View Coordinates Given the shape, transform all the points of the shape? Transform the points and/or vectors describing it. For example: Polygon: corner points Circle, Ellipse: center point(s), point at angle 0 Some transformations preserves some of the attributes like sizes, angles, ratios of the shape.

Translation Simply move the object to a relative position. T P P'P'

Rotation A rotation is defined by a rotation axis and a rotation angle. For 2D rotation, the parameters are rotation angle (θ) and the rotation point (x r,y r ). We reposition the object in a circular path arround the rotation point (pivot point) a xrxr yryr

Rotation When (x r,y r ) = (0,0) we have r P P'P' The original coordinates are: Substituting them in the first equation we get: In the matrix form we have: where

Rotation Rotation around an arbitrary point (x r,y r ) This equations can be written as matrix operations (we will see when we discuss homogeneous coordinates). r P P'P' (x r,y r )

Scaling Change the size of an object. Input: scaling factors (s x,s y ) P P'P' non-uniform vs. uniform scaling

Homogenous Coordinates All transformations can be represented by matrix operations. Translation is additive, rotation and scaling is multiplicative (+ additive if you rotate around an arbitrary point or scale around a fixed point); making the operations complicated. Adding another dimension to transformations make translation also representable by multiplication. Cartesian coordinates vs homogenous coordinates.

Many points in homogenous coordinates can represent the same point in Cartesian coordinates. In homogenous coordinates, all transformations can be written as matrix multiplications.

Transformations in Homogenous C. Translation Rotation Scaling

Composite Transformations Application of a sequence of transformations to a point:

Composite Transformations First: composition of similar type transformations If we apply to successive translations to a point:

Composite Transformations

Rotation around a pivot point – Translate the object so that the pivot point moves to the origin – Rotate around origin – Translate the object so that the pivot point is back to its original position

Scaling with respect to a fixed point – Translate to origin – Scale – Translate back

Order of matrix compositions Matrix composition is not commutative. So, be careful when applying a sequence of transformations. pivot same pivot

Other Transformations Reflection

Shear: Deform the shape like shifted slices. (1,1) (3,1) (2,1) (0,1)

3 DIMENSIONAL TRANSFORMATIONS

3D Transformations x,y,z coordinates. Usual notation: Right handed coordinate system Similar to 2D we have 4 dimensions in homogenous coordinates. Basic transformations: – Translation – Rotation – Scaling x y z z x y y z x

Translation move the object to a relative position. z y x z y x

Rotation Rotation arround the coordinate axes x axisy axisz axis z x y z x y z x y z x y z x y z x y Counterclockwise when looking along the positive half towards origin

Rotation around coordinate axes Arround x Arround y Arround z

Rotation Around a Parallel Axis Rotating the object around a line parallel to one of the axes: Translate to axis, rotate, translate back. z y x z y x z y x z y x TranslateRotateTranslate back

Rotation Around an Arbitrary Axis Translate the object so that the rotation axis passes though the origin Rotate the object so that the rotation axis is aligned with one of the coordinate axes Make the specified rotation Reverse the axis rotation Translate back z y x

Rotation Around an Arbitrary Axis

u is the unit vector along V: First step: Translate P 1 to origin: Next step: Align u with the z axis we need two rotations: rotate around x axis to get u onto the xz plane, rotate around y axis to get u aligned with z axis.

Rotation Around an Arbitrary Axis z x u Align u with the z axis 1) rotate around x axis to get u into the xz plane, 2) rotate around y axis to get u aligned with the z axis y α z x u y β z x u u' α uzuz y

Rotation Around an Arbitrary Axis z x u u' α Align u with the z axis 1) rotate around x axis to get u into the xz plane, 2) rotate around y axis to get u aligned with the z axis uzuz We need cosine and sine of α for rotation Projection of u on yz plane

Rotation Around an Arbitrary Axis z x u u''= (a,0,d) β Align u with the z axis 1) rotate around x axis to get u into the xz plane, 2) rotate around y axis to get u aligned with the z axis

Rotation,... Alternative Method Any rotation around origin can be represented by 3 orthogonal unit vectors: Define a new coordinate system with the given rotation axis u using: This matrix can be thought of as rotating the unit r 1*, r 2*, and r 3* vectors onto x, y, and z axes. So, to align a given rotation axis u onto the z axis, we can define an (orthogonal) coordinate system and form this R matrix

Rotation,... Alternative Method Check if this is equal to

Scaling Change the coordinates of the object by scaling factors. z y x z y x

Scaling with respect to a Fixed Point Translate to origin, scale, translate back z y x z y x z y x z y x TranslateScaleTranslate back

Scaling with respect to a Fixed Point

Reflection Reflection over planes, lines or points z y x z y x z y x z y x

OpenGL Geometric-Transformation Functions In the core OpenGL library, – a separate function is available for each basic transformation (translate, rotate, scale) – all transformations are specified in 3D Parameters – Translation: translation amount in x, y, z axes – Rotation: angle, orientation of the rotation axis that passes through the origin – Scaling: scaling factors for three coordinates

Basic OpenGL Transformations glTranslate* (tx, ty, tz); – For 2D applications set tz = 0 glRotate* (theta, vx, vy, vz); – theta in degrees – The rotation axis is defined by the vector (vx,vy,vz), i.e., P0 = (0,0,0) P1 = (vx,vy,vz) glScale* (sx, sy, sz); – Use negative values to get reflection transformation