Attributes of Graphics Primitives

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

David Luebke 1 4/28/2015 Aliasing & Antialiasing.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
David Luebke1/19/99 CS 551/651: Antialiasing David Luebke
CS 551 / CS 645 Antialiasing. What is a pixel? A pixel is not… –A box –A disk –A teeny tiny little light A pixel is a point –It has no dimension –It occupies.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Aliasing & Antialiasing
1 Computer Graphics Chapter 6 2D Transformations.
Math 1Hofstra University – CSC171A1 Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
2/7/2001Hofstra University – CSC290B1 Review: Math (Ch 4)
Modeling Objects by Polygonal Approximations
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Ch. 3: Forward and Inverse Kinematics
CS 450: Computer Graphics 2D TRANSFORMATIONS
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
10/5/04© University of Wisconsin, CS559 Fall 2004 Last Time Compositing Painterly Rendering Intro to 3D Graphics Homework 3 due Oct 12 in class.
CS 431/636 Advanced Rendering Techniques
Attributes of Graphics Primitives Sang Il Park Sejong University.
David Luebke 1 9/4/2015 CS 551/651: Advanced Computer Graphics Antialiasing Continued: Prefiltering and Supersampling.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Mathematical Fundamentals
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
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
Geometric Transformations Jehee Lee Seoul National University.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Geometric Transformations
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Rotation and Orientation: Fundamentals Jehee Lee Seoul National University.
Sang Il Park Sejong University
Attributes of Graphics Primitives Hearn & Baker Chapter 4 Some slides are taken from Robert Thomsons notes.
Geometric Transformations
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
Affine Geometry.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
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.
Geometric Transformations. Transformations Linear transformations Rigid transformations Affine transformations Projective transformations T Global reference.
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.
David Luebke 3/17/2016 Advanced Computer Graphics Antialiasing David Luebke
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
4. Geometric Objects and Transformations
Modeling Transformation
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Attributes of Graphics Primitives Hearn & Baker Chapter 4
Review: Transformations
3D Transformations Source & Courtesy: University of Wisconsin,
Review: Transformations
Homogeneous Coordinates (Projective Space)
Transformations.
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
(c) University of Wisconsin, CS559
Geometric Objects and Transformations (II)
TWO DIMENSIONAL TRANSFORMATION
Rotation and Orientation: Fundamentals
Presentation transcript:

Attributes of Graphics Primitives Sang Il Park Sejong University

OpenGL State variables: Color Point attributes Line attributes Fill-Area attributes

Boundary Filling

Flood Filling : Start a point inside the figure, replace a specified interior color only.

Scan Line Seed Fill scan line conversion seed filling + Shani, U., “Filling Regions in Binary Raster Images: A Graph-Theoretic Approach”, Computer Graphics, 14, (1981), 321-327

Boundary Filling Efficiency in space! finish the scan line containing the starting position process all lines below the start line process all lines above the start line

Problems of Filling Algorithm What happens if a vertex is shared by more than one polygon, e.g. three triangles? What happens if the polygon intersects itself? What happens for a “sliver”? Solutions? Redefine what it means to be inside of a triangle Different routines for nasty little triangles

OpenGL Fill-Area Function Shade model: Wire-frame or point: glShadeModel ( shadeModel ); GL_SMOOTH GL_FLAT glPolygonMode ( face, displayMode ); GL_FRONT GL_BACK GL_FRONT_AND_BACK GL_LINE GL_POINT GL_FILL

Aliasing in CG Which is the better?

Aliasing in CG Digital technology can only approximate analog signals through a process known as sampling The distortion of information due to low-frequency sampling (undersampling) Choosing an appropriate sampling rate depends on data size restraints, need for accuracy, the cost per sample… Errors caused by aliasing are called artifacts. Common aliasing artifacts in computer graphics include jagged profiles, disappearing or improperly rendered fine detail, and disintegrating textures.

The Nyquist Theorem the sampling rate must be at least twice the frequency of the signal or aliasing occurs

Aliasing Effects

Artifacts - Jagged profiles Jagged silhouettes are probably the most familiar effect caused by aliasing. Jaggies are especially noticeable where there is a high contrast between the interior and the exterior of the silhouette

Artifacts - Improperly rendered detail

Artifacts - Disintegrating textures The checkers should become smaller as the distance from the viewer increases.

Antialiasing Antialiasing methods were developed to combat the effects of aliasing. The two major categories of antialiasing techniques are prefiltering and postfiltering.

Prefiltering Eliminate high frequencies before sampling (Foley & van Dam p. 630) Convert I(x) to F(u) Apply a low-pass filter A low-pass filter allows low frequencies through, but attenuates (or reduces) high frequencies Then sample. Result: no aliasing!

High Frequency

Prefiltering

Prefiltering

Basis for Prefiltering Algorithms

Catmull’s Algorithm A2 A1 AB A3 Find fragment areas Multiply by fragment colors Sum for final pixel color

Prefiltering Example

Prefiltering So what’s the problem? Problem: most rendering algorithms generate sampled function directly e.g., Z-buffer, ray tracing

Supersampling The simplest way to reduce aliasing artifacts is supersampling Increase the resolution of the samples Average the results down Or sometimes, it is called “Postfiltering”.

Supersampling The process: Create virtual image at higher resolution than the final image Apply a low-pass filter Resample filtered image

Supersampling: Limitations Q: What practical consideration hampers super-sampling? A: Storage goes up quadratically Q: What theoretical problem does supersampling suffer? A: Doesn’t eliminate aliasing! Supersampling simply shifts the Nyquist limit higher

Supersampling: Worst Case Q: Give a simple scene containing infinite frequencies A: A checkered ground plane receding into infinity See next slide…

Supersampling Despite these limitations, people still use super-sampling (why?) So how can we best perform it?

Sampling in the Postfiltering method Supersampling from a 4*3 image. Sampling can be done randomly or regularly. The method of perturbing the sample positions is known as "jittering."

Stochastic Sampling Stochastic: involving or containing a random variable Sampling theory tells us that with a regular sampling grid, frequencies higher than the Nyquist limit will alias Q: What about irregular sampling? A: High frequencies appear as noise, not aliases This turns out to bother our visual system less!

Stochastic Sampling An intuitive argument: In stochastic sampling, every region of the image has a finite probability of being sampled Thus small features that fall between uniform sample points tend to be detected by non-uniform samples

Stochastic Sampling Idea: randomizing distribution of samples scatters aliases into noise Problem: what type of random distribution to adopt? Reason: type of randomness used affects spectral characteristics of noise into which high frequencies are converted

Stochastic Sampling Problem: given a pixel, how to distribute points (samples) within it? Grid Random Poisson Disc Jitter

Stochastic Sampling Poisson distribution: Completely random Add points at random until area is full. Uniform distribution: some neighboring samples close together, some distant

Stochastic Sampling Poisson disc distribution: Poisson distribution, with minimum- distance constraint between samples Add points at random, removing again if they are too close to any previous points Very even-looking distribution

Stochastic Sampling Jittered distribution Start with regular grid of samples Perturb each sample slightly in a random direction More “clumpy” or granular in appearance

Nonuniform Supersampling Adaptive Sampling

Adaptive Sampling Problem: Final Samples Many more blue samples than white samples But final pixel actually more white than purple! Simple filtering will not handle this correctly Final Samples

Filters

Antialiasing http://www.siggraph.org/education/materials/HyperGraph/aliasing

Geometric Transformations

Transformations Linear transformations Rigid transformations Local moving frame Linear transformations Rigid transformations Affine transformations Projective transformations T Global reference frame

Linear Transformations A linear transformation T is a mapping between vector spaces T maps vectors to vectors linear combination is invariant under T In 3-spaces, T can be represented by a 3x3 matrix

Examples of Linear Transformations 2D rotation 2D scaling

Examples of Linear Transformations 2D shear Along X-axis Along Y-axis

Examples of Linear Transformations 2D reflection Along X-axis Along Y-axis

Properties of Linear Transformations Any linear transformation between 3D spaces can be represented by a 3x3 matrix Any linear transformation between 3D spaces can be represented as a combination of rotation, shear, and scaling

Composing Transformations Suppose we want, We have to compose two transformations

Composing Transformations Matrix multiplication is not commutative Translation followed by rotation Translation followed by rotation

Composing Transformations R-to-L : interpret operations w.r.t. fixed coordinates L-to-R : interpret operations w.r.t local coordinates (Column major convention)

Changing Bases Linear transformations as a change of bases

Changing Bases Linear transformations as a change of bases

Affine Transformations An affine transformation T is an mapping between affine spaces T maps vectors to vectors, and points to points T is a linear transformation on vectors affine combination is invariant under T In 3-spaces, T can be represented by a 3x3 matrix together with a 3x1 translation vector

Homogeneous Coordinates Any affine transformation between 3D spaces can be represented by a 4x4 matrix Affine transformation is linear in homogeneous coordinates

Examples of Affine Transformations 2D rotation 2D scaling

Examples of Affine Transformations 2D shear 2D reflection

Examples of Affine Transformations 2D translation

Examples of Affine Transformations 2D transformation for vectors Translation is simply ignored

Examples of Affine Transformations 3D rotation

Pivot-Point Rotation Rotation with respect to a pivot point (x,y)

Fixed-Point Scaling Scaling with respect to a fixed point (x,y)

Scaling Direction Scaling along an arbitrary axis

Properties of Affine Transformations Any affine transformation between 3D spaces can be represented as a combination of a linear transformation followed by translation An affine transf. maps lines to lines An affine transf. maps parallel lines to parallel lines An affine transf. preserves ratios of distance along a line An affine transf. does not preserve absolute distances and angles

Review of Affine Frames A frame is defined as a set of vectors {vi | i=1, …, N} and a point o Set of vectors {vi} are bases of the associate vector space o is an origin of the frame N is the dimension of the affine space Any point p can be written as Any vector v can be written as

Changing Frames Affine transformations as a change of frame

Changing Frames Affine transformations as a change of frame

Changing Frames In case the xyz system has standard bases

Rigid Transformations A rigid transformation T is a mapping between affine spaces T maps vectors to vectors, and points to points T preserves distances between all points T preserves cross product for all vectors (to avoid reflection) In 3-spaces, T can be represented as

Rigid Body Rotation Rigid body transformations allow only rotation and translation Rotation matrices form SO(3) Special orthogonal group (Distance preserving) (No reflection)

Rigid Body Rotation R is normalized R is orthogonal The squares of the elements in any row or column sum to 1 R is orthogonal The dot product of any pair of rows or any pair columns is 0 The rows (columns) of R correspond to the vectors of the principle axes of the rotated coordinate frame

3D Rotation About Arbitrary Axis

3D Rotation About Arbitrary Axis Translation : rotation axis passes through the origin 2. Make the rotation axis on the z-axis 3. Do rotation 4. Rotation & translation

3D Rotation About Arbitrary Axis Rotate u onto the z-axis

3D Rotation About Arbitrary Axis Rotate u onto the z-axis u’: Project u onto the yz-plane to compute angle a u’’: Rotate u about the x-axis by angle a Rotate u’’ onto the z-asis

3D Rotation About Arbitrary Axis Rotate u’ about the x-axis onto the z-axis Let u=(a,b,c) and thus u’=(0,b,c) Let uz=(0,0,1)

3D Rotation About Arbitrary Axis Rotate u’ about the x-axis onto the z-axis Since we know both cos a and sin a, the rotation matrix can be obtained Or, we can compute the signed angle a Do not use acos() since its domain is limited to [-1,1]

Euler angles Arbitrary rotation can be represented by three rotation along x,y,z axis

Gimble Hardware implementation of Euler angles Aircraft, Camera

Euler Angles Rotation about three orthogonal axes 12 combinations XYZ, XYX, XZY, XZX YZX, YZY, YXZ, YXY ZXY, ZXZ, ZYX, ZYZ Gimble lock Coincidence of inner most and outmost gimbles’ rotation axes Loss of degree of freedom

Euler Angles Euler angles are ambiguous Two different Euler angles can represent the same orientation This ambiguity brings unexpected results of animation where frames are generated by interpolation.

Taxonomy of Transformations Linear transformations 3x3 matrix Rotation + scaling + shear Rigid transformations SO(3) for rotation 3D vector for translation Affine transformation 3x3 matrix + 3D vector or 4x4 homogenous matrix Linear transformation + translation Projective transformation 4x4 matrix Affine transformation + perspective projection

Taxonomy of Transformations Rigid Affine Projective

Composite Transformations Composite 2D Translation

Composite Transformations Composite 2D Scaling

Composite Transformations Composite 2D Rotation

OpenGL Geometric Transformations glMatrixMode(GL_MODELVIEW);

OpenGL Geometric Transformations Construction glLoadIdentity(); glTranslatef(tx, ty, tz); glRotatef(theta, vx, vy, vz); (vx, vy, vz) is automatically normalized glScalef(sx, sy, sz); glLoadMatrixf(Glfloat elems[16]); Multiplication glMultMatrixf(Glfloat elems[16]); The current matrix is postmultiplied by the matrix Row major

Hierarchical Modeling A hierarchical model is created by nesting the descriptions of subparts into one another to form a tree organization

OpenGL Matrix Stacks Four matrix modes Stack processing Modelview, projection, texture, and color glGetIntegerv(GL_MAX_MODELVIEW_STACK_DEPTH, stackSize); Stack processing The top of the stack is the “current” matrix glPushMatrix(); // Duplicate the current matrix at the top glPopMatrix(); // Remove the matrix at the top