Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003.

Slides:



Advertisements
Similar presentations
CSE 781 Anti-aliasing for Texture Mapping. Quality considerations So far we just mapped one point – results in bad aliasing (resampling problems) We really.
Advertisements

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.
Lecture 6: 3D Rendering Pipeline (III) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Computer Graphics Bing-Yu Chen National Taiwan University.
Texture Visual detail without geometry. Texture Mapping desire for heightened realism.
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.
IN4151 Introduction 3D graphics 1 Introduction 3D Computer Graphics part 1 Projective display Viewing pipeline Graphics hardware Image-based rendering.
Computer Graphics (Spring 2008) COMS 4160, Lecture 19: Texture Mapping Many slides from Greg Humphreys, UVA and Rosalee.
(conventional Cartesian reference system)
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
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.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
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.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
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.
CS 638, Fall 2001 Admin Grad student TAs may have had their accounts disabled –Please check and the lab if there is a problem If you plan on graduating.
Computer Graphics Texture Mapping
11/11/04© University of Wisconsin, CS559 Fall 2004 Last Time Shading Interpolation Texture mapping –Barycentric coordinates for triangles.
1 Texture Mapping ©Anthony Steed Overview n Texture mapping Inverse and Forward Mapping Bilinear interpolation Perspective correction n Mipmapping.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Texture Mapping.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Lecture 21Slide Fall 2001 Texture-Mapping Tricks Combining Textures Filtering Textures Textures and Shading Bump Mapping Solid Textures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Texture Mapping Fall, Textures Describe color variation in interior of 3D polygon  When scan converting a polygon, vary pixel colors according.
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.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
CS418 Computer Graphics John C. Hart
Lecture Fall 2001 From S. Zeki, Inner Vision.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
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,
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Texture Mapping Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006 (Slide set originally by David Luebke)
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
Texturing CMSC 435/ What is Texturing? 2 Texture Mapping Definition: mapping a function onto a surface; function can be: – 1, 2, or 3D – sampled.
Texturing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Week 7 - Wednesday CS361.
Texture Mapping Fall, 2016.
CSE 167 [Win 17], Lecture 18: Texture Mapping Ravi Ramamoorthi
Texture Mapping cgvr.korea.ac.kr.
The Graphics Rendering Pipeline
So Far We have assumed that we know: The point The surface normal
Interactive Graphics Algorithms Ying Zhu Georgia State University
© University of Wisconsin, CS559 Fall 2004
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Chapter 14 Shading Models.
Advanced Computer Graphics: Texture
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Texture Mapping Jung Lee.
Presentation transcript:

Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003

Surface Image Texture Textures Describe color variation in interior of 3D polygon  When scan converting a polygon, vary pixel colors according to values fetched from a texture Angel Figure 9.3 “Texels” “Pixels”

3D Rendering Pipeline (for direct illumination) 3D Primitives Modeling Transformation Modeling Transformation Projection Transformation Projection Transformation Clipping Lighting Image Viewport Transformation Viewport Transformation Scan Conversion Scan Conversion 2D Image Coordinates 3D Modeling Coordinates 3D World Coordinates 3D Camera Coordinates 2D Screen Coordinates Viewing Transformation Viewing Transformation 3D World Coordinates 2D Image Coordinates Texture mapping

Surface Textures Add visual detail to surfaces of 3D objects Polygonal model With surface texture

Surface Textures Add visual detail to surfaces of 3D objects [Daren Horley]

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]

Option: make an atlas [Sander2001] chartsatlassurface

Option: it’s the artist’s problem

Overview Texture mapping methods  Parameterization  Mapping  Filtering Texture mapping applications  Modulation textures  Illumination mapping  Bump mapping  Environment mapping  Image-based rendering  Volume textures  Non-photorealistic rendering

Texture Mapping Steps:  Define texture  Specify mapping from texture to surface  Lookup texture values during scan conversion (0,0) (1,0) (0,1) u v x y Modeling Coordinate System Image Coordinate System s t Texture Coordinate System

Texture Mapping When scan convert, map from …  image coordinate system (x,y) to  modeling coordinate system (u,v) to  texture image (t,s) (0,0) (1,0) (1,1) (0,1) u v x y Modeling Coordinate System Image Coordinate System s t Texture Coordinate System

Texture Mapping Allison Klein, Princeton Texture mapping is a 2D projective transformation  texture coordinate system: (t,s) to  image coordinate system (x,y)

Naïve Texture Mapping A first cut at a texture-mapping rasterizer:  For each pixel: »Interpolate u & v down edges and across spans »Look up nearest texel in texture map »Color pixel according to texel color (possibly modulated by lighting calculations)  McMillan’s demo of this is at  What artifacts do you see in this demo?

Naïve Texturing Artifacts Warping at edges of triangles A more obvious example: Consider the geometry of interpolating parameters more carefully

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 Is this a problem with Gouraud shading? A: It can be, but we usually don’t notice (why?) 

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 (Just 1?) 

Overview Texture mapping methods  Parameterization  Mapping  Filtering Texture mapping applications  Modulation textures  Illumination mapping  Bump mapping  Environment mapping  Image-based rendering  Non-photorealistic rendering

Texture Filtering Angel Figure 9.4 Must sample texture to determine color at each pixel in image

Texture Map Aliasing Naive texture mapping aliases badly Look familiar? int uval = (int) (u * denom + 0.5f); int vval = (int) (v * denom + 0.5f); int pix = texture.getPixel(uval, vval); Actually, each pixel maps to a region in texture  |PIX| < |TEX| »Easy: interpolate (bilinear) between texel values  |PIX| > |TEX| »Hard: average the contribution from multiple texels  |PIX| ~ |TEX| »Still need interpolation!

Texture Filtering Angel Figure 9.14 Size of filter depends on projective warp  Can prefilter images »Mip maps »Summed area tables MagnificationMinification

Mip Maps Keep textures prefiltered at multiple resolutions  For each pixel, linearly interpolate between two closest levels (e.g., trilinear filtering)  Fast, easy for hardware Why “Mip” maps?

MIP-map Example No filtering: MIP-map texturing: AAAAAAAGH MY EYES ARE BURNING Where are my glasses?

Summed-area tables At each texel keep sum of all values down & right  To compute sum of all values within a rectangle, simply subtract two entries  Better ability to capture very oblique projections  But, cannot store values in a single byte S1S1 S2S2

Summed-Area Tables Mipmaps assume that each pixel projects to a square in the texture (which is a lie) SAT can integrate texels covered by the pixel more exactly (but still quickly) Example: MIP-map texturingSummed-area table texturing

Overview Texture mapping methods  Parameterization  Mapping  Filtering Texture mapping applications  Modulation textures  Illumination mapping  Bump mapping  Environment mapping  Image-based rendering  Non-photorealistic rendering

Modulation textures Map texture values to scale factor Wood texture Texture value

Texture Mapping Variations A texture can modulate any parameter in the Phong lighting equation Texture as R,G,B: Texture as diffuse lighting coefficients:

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

+ = More Bump Mapping How can you tell a bumped-mapped object from an object in which the geometry is explicitly modeled?

Displacement Mapping

Illumination Maps Quake introduced illumination maps or light maps to capture lighting effects in video games Texture map: Texture map + light 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

Solid textures Texture values indexed by 3D location (x,y,z) Expensive storage, or Compute on the fly, e.g. Perlin noise 

Procedural Texture

Procedural Texture Gallery