So Far We have assumed that we know: The point The surface normal

Slides:



Advertisements
Similar presentations
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
Advertisements

16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
9.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
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.
3D Graphics Rendering and Terrain Modeling
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Computer Graphics Bing-Yu Chen National Taiwan University.
 Engineering Graphics & Introductory Design 3D Graphics and Rendering REU Modeling Course – June 13 th 2014.
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 12 Solid Textures Bump Mapping Environment Mapping.
Computer Graphics (Spring 2008) COMS 4160, Lecture 19: Texture Mapping Many slides from Greg Humphreys, UVA and Rosalee.
(conventional Cartesian reference system)
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 18: Shading & Texture Mapping Many slides from Greg.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Texture Mapping.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008.
1 Texturing. 2 What is Texturing? 3 Texture Mapping Definition: mapping a function onto a surface; function can be:  1, 2, or 3D  sampled (image) or.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
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.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
David Luebke 1 9/13/2015 Texture Mapping. David Luebke 2 9/13/2015 Recap: Texture Map Rendering ● Rendering uses the mapping: ■ Find the visible surface.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
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.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
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.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
CS559: Computer Graphics Lecture 20: Project 2 Review and Texture mapping Li Zhang Spring 2010 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys,
CS559: Computer Graphics Lecture 21: Subdivision, Bspline, and Texture mapping Li Zhang Spring 2008.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003.
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

University of New Mexico
Buffers and texture mapping
Texture Mapping.
Computer Graphics Texture Mapping
CSE 167 [Win 17], Lecture 18: Texture Mapping Ravi Ramamoorthi
© University of Wisconsin, CS559 Spring 2004
ATCM 3310 Procedural Animation
Graphics, Fall 2017 Lecture 24: Texture Mapping
3D Graphics Rendering PPT By Ricardo Veguilla.
Texture Mapping COMP575/COMP770.
The Graphics Rendering Pipeline
Chapter 14 Shading Models.
© University of Wisconsin, CS559 Fall 2004
Procedural Animation Lecture 6: Mapping
ATCM 6317 Procedural Animation
CS-378: Game Technology Lecture #4: Texture and Other Maps
Texture Mapping Ed Angel Professor Emeritus of Computer Science
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Computer Graphics (Fall 2003)
Chapter 14 Shading Models.
Advanced Computer Graphics: Texture
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

So Far We have assumed that we know: The point The surface normal The viewer location (or direction) The light location (or direction) But commonly, normal vectors are only given at the vertices and it is expensive to compute lighting for every point Objects rendered using Phong reflection model and Gouraud or Phong interpolated shading often appear rather ‘plastic’ and ‘floating in air’ Breaking the scene into smaller and smaller polygonal objects increases the detail BUT it is very hard to model and very time-consuming to render

Texture Mapping Texture effects can be added to give more realistic looking surface appearance Texture mapping associates the color of a point with the color in a texture image - a 2D image is ‘painted’ onto the object

+ = Parameterization geometry image texture map Q: How do we decide where on the geometry each color from the image should go?

Option: Varieties of projections [Paul Bourke]

Option: unfold the surface [Piponi2000]

How to map object to texture? To each vertex (x,y,z in object coordinates), must associate 2D texture coordinates (s,t) So texture fits “nicely” over object

Idea: Use Map Shape Map shapes correspond to various projections Planar, Cylindrical, Spherical First, map (square) texture to basic map shape Then, map basic map shape to object Or vice versa: Object to map shape, map shape to square Usually, this is straightforward Maps from square to cylinder, plane, sphere well defined Maps from object to these are simply spherical, cylindrical, cartesian coordinate systems

Planar mapping Like projections, drop z coord (s,t) = (x,y) Problems: what happens near z = 0?

Cylindrical Mapping Cylinder: r, θ, z with (s,t) = (θ/(2π),z) Note seams when wrapping around (θ = 0 or 2π)

Spherical Mapping Convert to spherical coordinates: use latitude/long. Singularities at north and south poles

Cube Mapping

Cube Mapping

Texture Mapping Main Issues How do we map between 3D How does the texture modify the shading of pixels? How do we sample the texture for a fragment?

Texture Mapping v u Interpolation Texture Mapping (painting) We need to define a mapping between the 3D world space (x,y,z) and 2D image space (s,t) [0,1]2 Texture coordinates defined at vertices serve this purpose Specify (s,t) at each vertex: u v V2 V1 V0

Texture Mapping Interpolate in the interior: v u Mapping the object on the left to the texture on the right

Texture Mapping v (50, 50) Interpolate in the interior: (100, 15) (3, 3) V1(20, 3) (100, 15) V0(0,0) (0, 0) Consider the y value of 3 in the interpolation across the triangle. The rendering process determines that the range of object coordinates are from (3, 3) to (20, 3). The first co-ordinate comes from the interpolation along the left edge of the triangle at a parametric value t = 0.3.

Texture Mapping v (50, 50) Interpolate in the interior: (15, 15) (3, 3) (15, 15) V1(20, 3) (100, 15) V0(0,0) (0, 0) The texture location for this left edge location is (15, 15). Why? Object locations are interpolated from (3, 3) to (20, 3) Texture locations are interpolated from (15, 15) to (100, 15)

Texture Mapping v (50, 50) Interpolate in the interior: (15, 15) (3, 3) (15, 15) V1(20, 3) (100, 15) V0(0,0) (0, 0) The texture gives a value that will influence the shading process. Specifically, the value from the texture replaces the diffuse constant in the calculation of the diffusion component in the illumination equation. By doing so, the texture values change the object appearance, but shape cues that come from the specular highlights will stay the same.

Texture Mapping v (50, 50) Interpolate in the interior: y (u, v) (x, y) (3, 3) (15, 15) V1(20, 3) (100, 15) V0(0,0) (0, 0) x

Texture Mapping v (50, 50) Interpolate in the interior: y (u, v) (x, y) (3, 3) (15, 15) V1(20, 3) (100, 15) V0(0,0) (0, 0) x A texture location can be calculated from object location directly. In general, mapping an object with x coordinates in the range from xmin to xmax and y coordinates in the range ymin to ymax into the texture coordinate range can be computed as: umin , umax , vmin , vmax are determined by the range of texture values assigned to the object vertices.

Texture Mapping Interpolate in the interior: - Painted texture Simple But can have problems – especially for highly irregular surfaces

Artifacts McMillan’s demo of this is at http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide05.html Another example http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide06.html What artifacts do you see? Why? Why not in standard Gouraud shading? Hint: problem is in interpolating parameters

Interpolating Parameters The problem turns out to be fundamental to interpolating parameters in screen-space Uniform steps in screen space  uniform steps in world space

Texture Mapping Linear interpolation of texture coordinates Correct interpolation with perspective divide Hill Figure 8.42

Interpolating Parameters Perspective foreshortening is not getting applied to our interpolated parameters Parameters should be compressed with distance Linearly interpolating them in screen-space doesn’t do this

Perspective-Correct Interpolation Skipping a bit of math to make a long story short… Rather than interpolating u and v directly, interpolate u/z and v/z These do interpolate correctly in screen space Also need to interpolate z and multiply per-pixel Problem: we don’t know z anymore Solution: we do know w  1/z So…interpolate uw and vw and w, and compute u = uw/w and v = vw/w for each pixel This unfortunately involves a divide per pixel http://graphics.lcs.mit.edu/classes/6.837/F98/Lecture21/Slide14.html

Texture Map Filtering Naive texture mapping aliases badly Moire pattern

Mapping to Curved Surfaces A pixel A curved image Parametric surface x=x(u,v) y=y(u,v) z=z(u,v) The task is to map texture to surface, or to find a mapping u=as+bt+c v=ds+et+f

Bump Mapping This is another texturing technique Aims to simulate a dimpled or wrinkled surface for example, surface of an orange Like Gouraud and Phong shading, it is a trick surface stays the same but the true normal is perturbed, to give the illusion of surface ‘bumps’

How Does It Work? Looking at it in 1D: Original surface P(u) Bump map b(u) Add b(u) to P(u)in surface normal direction, N(u) New surface normal N’(u) for reflection model

Bump Mapping Example Bump map Result

Bump Mapping Example Texture = change in surface normal! Sphere w/ diffuse texture and swirly bump map Sphere w/ diffuse texture Swirly bump map

Illumination Maps Texture map: Texture map + light map: Quake introduced illumination maps or light maps to capture lighting effects in video games Texture map: Light map Texture map + light map:

Environment Maps Images from Illumination and Reflection Maps: Simulated Objects in Simulated and Real Environments Gene Miller and C. Robert Hoffman SIGGRAPH 1984 “Advanced Computer Graphics Animation” Course Notes