Lecture 6 Rasterisation, Antialiasing, Texture Mapping,

Slides:



Advertisements
Similar presentations
Computer Graphics An Introduction. What’s this course all about? 05/10/2014 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
Advertisements

Lecture 8 Transparency, Mirroring
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
Computer Graphics Viewing, Rendering, Antialiasing گرد آوري و تاليف: دكتر احمد رضا نقش نيل چي دانشگاه اصفهان گروه مهندسي كامپيوتر.
3D Graphics Rendering and Terrain Modeling
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Week 7 - Wednesday.  What did we talk about last time?  Transparency  Gamma correction  Started texturing.
Computer Graphics Inf4/MSc Computer Graphics Lecture 13 Illumination I – Local Models.
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.
CIS 681 Distributed Ray Tracing. CIS 681 Anti-Aliasing Graphics as signal processing –Scene description: continuous signal –Sample –digital representation.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Computer Graphics Shadows
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
9/20/2001CS 638, Fall 2001 Today Finishing Up Reflections More Multi-Pass Algorithms Shadows.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Hidden Surface Removal
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
Computer Graphics Mirror and Shadows
Filtering theory: Battling Aliasing with Antialiasing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
1 Texture. 2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
1 Texture Mapping ©Anthony Steed Overview n Texture mapping Inverse and Forward Mapping Bilinear interpolation Perspective correction n Mipmapping.
Computer Graphics An Introduction. What’s this course all about? 06/10/2015 Lecture 1 2 We will cover… Graphics programming and algorithms Graphics data.
COMP 261 Lecture 16 3D Rendering. input: set of polygons viewing direction direction of light source(s) size of window. output: an image Actions rotate.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
CS 450: COMPUTER GRAPHICS ANTIALIASING SPRING 2015 DR. MICHAEL J. REALE.
3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.
Week 6 - Wednesday.  What did we talk about last time?  Light  Material  Sensors.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
CS418 Computer Graphics John C. Hart
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
CS559: Computer Graphics Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 5 Hidden Surface Removal and Rasterization Taku Komura.
Lecture 30: Visible Surface Detection
Texturing CMSC 435/ What is Texturing? 2 Texture Mapping Definition: mapping a function onto a surface; function can be: – 1, 2, or 3D – sampled.
Applications and Rendering pipeline
Week 7 - Monday CS361.
Week 2 - Friday CS361.
ATEC Procedural Animation
Distributed Ray Tracing
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
So Far We have assumed that we know: The point The surface normal
Real-time Computer Graphics Overview
Lecture 13 Clipping & Scan Conversion
Procedural Animation Lecture 6: Mapping
CS-378: Game Technology Lecture #4: Texture and Other Maps
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Introduction to Meshes
Presentation transcript:

Lecture 6 Rasterisation, Antialiasing, Texture Mapping, Computer Graphics Lecture 6 Rasterisation, Antialiasing, Texture Mapping,

Some Tutorial about the Project I have already covered all the topics needed to finish the 1st practical Today, I will briefly explain how to start working on it. I have already provided you a program to import an obj file.

Steps Apply transformations to all vertices Prepare the frame buffer and Z-buffer For each triangle Project it to the screen space Find the 2D bounding box For each pixel in the bounding box Check if it is inside the triangle by computing its barycentric coordinates If yes, use barycentric coordinates to compute the depth and colour at the pixel If (depth < zbuf[pixel]) { framebuffer[pixel] = colour zbuf[pixel] = depth } Export the frame buffer data into a PPM file Apply transformations to all vertices Prepare the frame buffer and Z-buffer For each triangle Project it to the screen space Find the 2D bounding box For each pixel in the bounding box Check if it is inside the triangle by computing its barycentric coordinates If yes, use barycentric coordinates to compute the depth and colour at the pixel If (depth < zbuf[pixel]) { framebuffer[pixel] = colour zbuf[pixel] = depth }

For each pixel in the bounding box Check if it is inside the triangle by computing its barycentric coordinates If yes, use barycentric coordinates to compute the depth and colour at the pixel z = αz1 + β z2 + γ z3 c = αc1 + β c2 + γ c3 If (z < zbuf[pixel]) { framebuffer[pixel] = colour zbuf[pixel] = c }

Computing the baricentric coordinates of the interior pixels The triangle is composed of 3 points p0 (x0,y0), p1 (x1, y1), p2(x2,y2)‏ (α,β,γ) : barycentric coordinates Only if 0<α,β,γ<1, (x,y) is inside the triangle Depth can be computed by αZ0 + βZ1 +γZ2 Can do the same thing for color, normals, textures

Today Anti-aliasing Texture mapping Common texture coordinates mapping

Rasterisation Converts the vertex information output by the geometry pipeline into pixel information needed by the video display Anti-aliasing Z-buffer Texture mapping Bump mapping Transparent objects Drawing lines

Anti-aliasing Aliasing: distortion artifacts produced when representing a high-resolution signal at a lower resolution. Anti-aliasing : techniques to remove aliasing Aliased polygons (jagged edges)‏ Anti-aliased polygons

Nyquist Limit The signal frequency (fsignal) should be no greater than half the sample frequency (fsample) fsignal <= 0.5 fsample In the top, fsignal = 0.8 fsample -> cannot reconstruct the original signal In the bottom fsignal =0.5 fsample -> the original signal can be reconstructed by slightly increasing the sampling rate

Screen-based Anti-aliasing Each pixel is subdivided (sub-sampled) into n regions, and each sub-pixel has a color; Compute the average color value

Accumulation Buffer (A-Buffer)‏ Use a buffer that has the same resolution as the original image To obtain a 2x2 sampling of a scene, 4 images are made by shifting the buffer horizontally/vertically for half a pixel The results are accumulated and the final results are obtained by averaging Various sampling schemes are available Pixel center Subsampled point

Different Sampling Schemes

Accumulation Buffer (A-Buffer)‏ The lighting computation is usually done only once per vertex Not doing the lighting computation at each sample point The A-buffer’s focus is on the edge anti- aliasing Also useful for rendering transparent objects, motion blur (will be covered later in the course) Edges

Stochastic Sampling A scene can be produced of objects that are arbitrarily small A regular pattern of sampling will always exhibit some sort of aliasing One approach to solve this is to randomly sample over the pixel Jittering : subdivide into n regions of equal size and randomly sample inside each region

The oversampling rate is 1 and 2 from left to right

Today Anti-aliasing Texture mapping Common texture coordinates mapping

Texture Mapping : Why needed? We don't want to represent all this detail with geometry

Texture mapping. Method of improving surface appearance by adding details on surface.

Texture mapping. Image is ‘pasted’ onto a polygon. Image is called a Texture map, it’s pixels are often referred as a Texels and have coordinates (u,v)‏ Texture coordinates are defined for each vertex of the polygon and interpolated across the polygon. v u y x

Photo-textures

Texture Interpolation Specify a texture coordinate (u,v) at each vertex Can we just linearly interpolate the values in screen space? (0,0)‏ (1,0)‏ (0,1)‏

Interpolating the uv coordinates Again, we use baricentric coordinates u= α u1 + β u2 + γ u3 v = α v1 + β v2 + γ v3 u1 v1 u3 v3 u2 v2

Interpolation - What Goes Wrong? Linear interpolation in screen space: texture source what we get| what we want

Why does it happen? Uniform steps on the image plane does not correspond to uniform steps along the edge

How do we deal with it? Use hyperbolic interpolation (u,v) cannot be linearly interpolated, but 1/w and (u/w, v/w) can w is the last component after the canonical view transformation

Texture Mapping Examples Linear interpolation vs. Hyperbolic interpolation Two triangles per square

Computing the uv coordinates at the internal points For three points of the triangle, get Compute at the internal points of the triangle by interpolation Compute wi by inverting 1/wi, and multiply them to (ui /wi, ,vi /wi) to compute (ui,vi)‏

Common Texture Coordinate Mappings Orthogonal Cylindrical Spherical

Texture Mapping & Illumination Texture mapping can be used to alter some or all of the constants in the illumination equation: pixel color, diffuse color …. Phong’s Illumination Model Diffuse Texture Color Constant Diffuse Color Texture used as Label Texture used as Diffuse Color

Readings Chapter 5.1-2 of Real-Time Rendering Second edition http://books.google.co.uk/books?id=mOKEfBT w4x0C&printsec=frontcover&source=gbs_v2_ summary_r&cad=0#v=onepage&q=&f=false “Hyperbolic Interpolation” IEEE Computer Graphics and Applications, vol12, no.4, 89- 94, 1992 Demoed Software http://www-ui.is.s.u-tokyo.ac.jp/~takeo/java/smoothteddy/index.html