Texture Mapping. Michael Kazhdan ( /467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, , 16.6

Similar documents
3D Rasterization II COS 426

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Texture mapping. Computer Graphics CSE 167 Lecture 9

CS 130 Final. Fall 2015

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Shading II. CITS3003 Graphics & Animation

Pipeline Operations. CS 4620 Lecture 10

Texture Mapping 1/34

Graphics Hardware and Display Devices

Graphics and Interaction Rendering pipeline & object modelling

CPSC / Texture Mapping

Rendering Light Reflection Models

CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

CS451 Texturing 4. Bump mapping continued. Jyh-Ming Lien Department of Computer SCience George Mason University. From Martin Mittring,

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

Visit MathNation.com or search "Math Nation" in your phone or tablet's app store to watch the videos that go along with this workbook!

Pipeline Operations. CS 4620 Lecture 14

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Lesson 1: Why Move Things Around?

CS 464 Review. Review of Computer Graphics for Final Exam

Acceleration Data Structures

3D Modelling: Animation Fundamentals & Unit Quaternions

CS 354R: Computer Game Technology

CS4620/5620: Lecture 14 Pipeline

CHAPTER 1 Graphics Systems and Models 3

CS 431/636 Advanced Rendering Techniques

Today. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik

Topics and things to know about them:

CS 432 Interactive Computer Graphics

Section 1: Introduction to Geometry Points, Lines, and Planes

Sung-Eui Yoon ( 윤성의 )

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19

Lesson 12: Angles Associated with Parallel Lines

Computer Graphics Ray Casting. Matthias Teschner

recruitment Logo Typography Colourways Mechanism Usage Pip Recruitment Brand Toolkit

Rasterization Overview

Texture-Mapping Tricks. How Bad Does it Look? We've Seen this Sort of Thing Before. Sampling Texture Maps

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Textures. Texture coordinates. Introduce one more component to geometry

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Introduction to Computer Graphics with WebGL

The University of Calgary

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Introduction to 3D Concepts

Illumination and Shading

COMP30019 Graphics and Interaction Rendering pipeline & object modelling

Lecture outline. COMP30019 Graphics and Interaction Rendering pipeline & object modelling. Introduction to modelling

OXFORD ENGINEERING COLLEGE (NAAC Accredited with B Grade) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS


Computer Graphics 1. Chapter 7 (June 17th, 2010, 2-4pm): Shading and rendering. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

CS452/552; EE465/505. Clipping & Scan Conversion

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Graphics Pipeline. CS535 Fall Daniel G. Aliaga Department of Computer Science Purdue University

CS 4620 Program 3: Pipeline

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Computergrafik. Matthias Zwicker. Herbst 2010

CIS 581 Interactive Computer Graphics

CS451Real-time Rendering Pipeline

Chapter 11 Global Illumination. Part 1 Ray Tracing. Reading: Angel s Interactive Computer Graphics (6 th ed.) Sections 11.1, 11.2, 11.

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Models and Architectures

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Dual-Paraboloid Shadow Mapping. A paper by Stefan Brabec, Thomas Annen, Hans-Peter Seidel Presented By Patrick Wouterse, Selmar Kok

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Perspective Projection and Texture Mapping

COMP environment mapping Mar. 12, r = 2n(n v) v

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

Introduction to Computer Graphics

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

COMPUTER GRAPHICS COURSE. LuxRender. Light Transport Foundations

Einführung in Visual Computing

Complex Shading Algorithms

Chapter 5. Projections and Rendering

Eureka Math. Grade 7, Module 6. Student File_A. Contains copy-ready classwork and homework

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

CS559 Computer Graphics Fall 2015

TRIGONOMETRY. T.1 Angles and Degree Measure

CS559 Computer Graphics Fall 2015

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Institutionen för systemteknik

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

For Intuition about Scene Lighting. Today. Limitations of Planar Shadows. Cast Shadows on Planar Surfaces. Shadow/View Duality.

+ = To Do. Texture Mapping. Adding Visual Detail. Parameterization. Option: Varieties of projections. Computer Graphics. geometry

03 RENDERING PART TWO

Local Illumination physics. Law of reflection and Snell s law of refraction

Surface Rendering. Surface Rendering

Visibility. Tom Funkhouser COS 526, Fall Slides mostly by Frédo Durand

+ = To Do. Adding Visual Detail. Texture Mapping. Parameterization. Option: Varieties of projections. Foundations of Computer Graphics (Fall 2012)

Three Main Themes of Computer Graphics

Transcription:

Texture Mapping Michael Kazhdan (61.457/467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, 16.4.5, 16.6

Textures We know how to go from this to this J. Birn

Textures But what about this to this? J. Birn

Textures How do we draw surfaces with complex detail? Target Model

Textures How do we draw surfaces with complex detail? Direct: Tessellate in a complex manner and then associate the appropriate material properties to each vertex Target Model Complex Surface

Textures How do we draw surfaces with complex detail? Indirect: Use a simple tessellation with an auxiliary texture image. Use the location of surface points to look up color values from the texture. Target Model Simple Surface Texture Image

Textures Advantages: The 3D model remains simple It is easier to design/modify a texture image than it is to design/modify a surface in 3D. Target Model Simple Surface Texture Image

Textures (2 dimensions) Implementation: Associate a texture coordinate to each vertex vv: (ss vv, tt vv ) with ( ss vv, tt vv 1) When rasterizing, interpolate to get the texture coordinate to at a pixel: (ss pp, tt pp ) Sample the texture at ss pp, tt pp to get the color at pp.

Example: Brick Wall

Example: Brick Wall ss vv, tt vv = (,1) ss vv, tt vv = (1,1) + ss vv, tt vv = (,) ss vv, tt vv = (1,)

Textures (2 dimensions) Coordinates described by variables ss and tt and range over interval (,1) Texture elements are called texels Often 4 bytes (rgba) per texel tt ss

Texture (dd dimensions) Given: A dd-dimensional (multi-channel) texture image an assignment of coordinates (ss vv 1,, ss vv dd ) ranging over interval (,1) to each vertex At rasterization: Interpolate the texture coordinates to get the texture coordinate at each pixel, ss pp 1,, ss pp dd Sample the texture at ss pp 1,, ss pp dd to get the value at pp

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

3D Rendering Pipeline 3D Primitives 3D Modeling Coordinates Modeling Transformation 3D World Coordinates Viewing Transformation Lighting 3D World Coordinates Perform the texture interpolation and look-up while rasterizing the pixels. (ss 1, tt 1 ) 3D Camera Coordinates Projection Transformation Clipping 2D Screen Coordinates AA αα γγ (ss, tt) BB (ss 3, tt 3 ) 2D Screen Coordinates Viewport Transformation 2D Image Coordinates Scan Conversion Image 2D Image Coordinates (ss 2, tt 2 ) texture mapping ββ

Overview Texture mapping methods Parameterization Filtering Texture mapping applications Modulation textures Illumination mapping Bump mapping Environment mapping Shadow maps

Map to a base domain Deform the geometry into a simple surface (with the same topology) Define a texture map over the simple surface Get a continuous map from the surface to the texture map

Map to a Base Domain Deform the geometry into a simple surface (with the same topology) Define a texture map over the simple surface Get a continuous map from the surface to the texture map Tricky, because mapped surface will have severe distortions It is impossible to parameterize a complex shape to a simple domain so lengths are preserved

Map to a 2D Domain w/ Cuts Introduce cuts to give the surface a disk topology Map the cut surface to the 2D plane Assign texture coordinates in the plane Good cut placement can reduce distortion Need to ensure cross-seam continuity [Piponi2]

Texture Atlases Decompose the surface into multiple charts Map each chart to the 2D plane Assign texture coordinates in the plane Even less distortion in the mapping Even harder to ensure cross-seam continuity Need to pack the atlases into 2D [Sander21]

Overview Texture mapping methods Parameterization Filtering Texture mapping applications Modulation textures Illumination mapping Bump mapping Environment mapping Shadow maps

Texture Filtering Sample texture to determine color at each pixel Texture Screen 3D Angel Figure 9.4

Texture Filtering Sample texture to determine color at each pixel If the screen texture transformation does not preserve areas, we need to compute the average of the pixels in texture space. Average over many pixels Screen Texture

Texture Filtering Size of filter depends on the deformation Computation is linear in the size of the pixel footprint Can prefilter images for better performance Mip maps Summed area tables Average over many pixels Screen Texture

Mip Maps Keep textures prefiltered at multiple resolutions Screen Texture hierarchy

Mip Maps For each pixel, use the closest mip-map level(s) Easy for hardware Computation is constant in the size of the pixel footprint Average over a few pixels Screen Texture hierarchy

Mip Maps For each pixel, use the closest mip-map level(s) Storage is only 4/3 the size of the input image

Mip Maps For each pixel, use the closest mip-map level(s) Storage is only 4/3 the size of the input image This type of filtering is isotropic: Assumes there is the same amount of compression along the vertical and horizontal directions tt Again: we re trading aliasing for blurring! ss

Summed-Area Tables Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle: Sum( aa, bb cc, dd] = aa bb dd ff xx, yy dddd dddd cc tt tt (aa, dd) (bb, dd) (aa, cc) (bb, cc) ss ss

Summed-Area Tables bb aa Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle. Perform the integration quickly by pre-computing integrals and leveraging the formula: dd cc ff xx, yy dddd dddd = bb dd ff xx, yy dddd dddd bb cc ff xx, yy dddd dddd aa dd ff xx, yy dddd dddd + aa cc ff xx, yy dddd dddd

Summed-Area Tables bb aa Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle. Perform the integration quickly by pre-computing integrals and leveraging the formula dd cc ff xx, yy dddd dddd = bb dd ff xx, yy dddd dddd tt bb cc ff xx, yy dddd dddd aa dd ff xx, yy dddd dddd + aa cc ff xx, yy dddd dddd ss

Summed-Area Tables bb aa Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle. Perform the integration quickly by pre-computing integrals and leveraging the formula dd cc ff xx, yy dddd dddd = bb dd ff xx, yy dddd dddd tt bb cc ff xx, yy dddd dddd aa dd ff xx, yy dddd dddd + aa cc ff xx, yy dddd dddd ss

Summed-Area Tables bb aa Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle. Perform the integration quickly by pre-computing integrals and leveraging the formula dd cc ff xx, yy dddd dddd = bb dd ff xx, yy dddd dddd tt bb cc ff xx, yy dddd dddd aa dd ff xx, yy dddd dddd + aa cc ff xx, yy dddd dddd ss

Summed-Area Tables bb aa Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle. Perform the integration quickly by pre-computing integrals and leveraging the formula dd cc ff xx, yy dddd dddd = bb dd ff xx, yy dddd dddd tt bb cc ff xx, yy dddd dddd aa dd ff xx, yy dddd dddd + aa cc ff xx, yy dddd dddd ss

Summed-Area Tables bb aa Key Idea: Approximate the summation/integration over an arbitrary region by a summation/integration over an axis-aligned rectangle. Perform the integration quickly by pre-computing integrals and leveraging the formula dd cc ff xx, yy dddd dddd = bb dd ff xx, yy dddd dddd tt bb cc ff xx, yy dddd dddd aa dd ff xx, yy dddd dddd + aa cc ff xx, yy dddd dddd ss

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 4 2 1 1 2 1 3 Summed area table

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 4 2 1 1 2 1 3 1 Summed area table

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 4 2 1 1 2 1 3 1 3 Summed area table

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 4 2 1 Summed area table 1 2 1 3 1 3 4

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 4 2 1 Summed area table 1 2 1 3 1 3 4 7

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 Summed area table 4 2 1 1 2 1 3 5 1 3 4 7

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 3 1 1 Summed area table 4 2 1 1 2 1 3 5 9 1 3 4 7

Summed-Area Tables (Pre-Process) Precompute the values of the integral: SS aa, bb = aa bb ff xx, yy dddd dddd Each summed-area table texel is the sum of all input texels below and to the left Input image 1 2 4 Summed area table 6 15 21 26 3 1 1 4 2 1 1 2 1 3 5 12 14 19 5 9 1 14 1 3 4 7

Summed-Area Tables (Run-Time) Given a pixel on the screen that maps to a rectangle in texture space, use the summed area table to compute the average: Sum 1,3 2,3 = S 3,3 S,3 S 3,1 + S,1 = 26 6 14 + 5 = 11 Sum 1,3 2,3 Average 1,3 2,3 = Area 1,3 2,3 = 11 6 1 2 4 3 1 1 4 2 1 1 2 1 3 Input image 6 15 21 26 5 12 14 19 5 9 1 14 1 3 4 7 Summed-area table

Summed-Area Tables (Run-Time) Precompute the values of the integral Constant time averaging, regardless of rectangle size If the input image has values in the range [,255] (i.e. one byte per channel), the summed area table can have values in the range [,255 width height] 1 2 4 3 1 1 4 2 1 1 2 1 3 Input image 6 15 21 26 5 12 14 19 5 9 1 14 1 3 4 7 Summed-area table

Overview Texture mapping methods Parameterization Filtering Texture mapping applications Modulation textures Illumination mapping Bump mapping Environment mapping Shadow mapping

Modulation textures Map texture values to scale factor Modulation II = TT ss, tt II EE + KK AA II AAAA + ii KK DD NN, LL ii II ii + KK SS VV, RR ii nn II ii

Illumination Mapping Map texture values to a material parameter Modulation Diffuse II = II EE + KK AA II AAAA + ii TT(ss, tt) NN, LL ii II ii + KK SS VV, RR ii nn II ii

Illumination Mapping Map texture values to a material parameter Modulation Diffuse Note that we need to evaluate the texture at each pixel but can still use the interpolated lighting values NN, LL ii II = II EE + KK AA II AAAA + ii TT(ss, tt) NN, LL ii II ii + KK SS VV, RR ii nn II ii

Illumination Mapping Map texture values to a material parameter Modulation Diffuse Specular II = II EE + KK AA II AAAA + ii KK DD NN, LL ii II ii + TT(ss, tt) VV, RR ii nn II ii

Illumination Mapping Map texture values to a material parameter Modulation Diffuse Specular Again, we can use the interpolated lighting values VV, RR ii nn II = II EE + KK AA II AAAA + ii KK DD NN, LL ii II ii + TT(ss, tt) VV, RR ii nn II ii

Bump Mapping Recall that many parts of our lighting calculation depend on surface normals NN θθ LL Surface II = II EE + KK AA II AAAA + ii KK DD NN, LL ii II ii + KK ss VV, RR ii nn II ii

Bump Mapping Phong shading performs per-pixel lighting calculations with the interpolated normal approximates a smoothly curved surface Bump maps encode the normals in the texture approximates a more complex undulating surface P. Rheingans

Bump Mapping H&B Figure 14.1

Bump Mapping Note that bump mapping does not change object silhouette Siggraph.org

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection Set the texture coordinates based on the direction of the reflected view direction

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection Set the texture coordinates based on the direction of the reflected view direction

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection Set the texture coordinates based on the direction of the reflected view direction

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection Set the texture coordinates based on the direction of the reflected view direction At the same triangle, changing the position of the camera changes the texture coordinates.

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection Set the texture coordinates based on the direction of the reflected view direction At the same triangle, changing the position of the camera changes the texture coordinates.

Environment Mapping Generate a spherical/cubic map of the environment around the model. Texture coordinates are computed dynamically through reflection Set the texture coordinates based on the direction of the reflected view direction At the same triangle, changing the position of the camera changes the texture coordinates.

Environment Mapping Texture coordinates are computed dynamically through reflection of the view direction through the surface normal P. Debevec

Shadow Mapping (Williams 1978) Test if surface is visible to the light when computing the contribution the lighting equation. Images courtesy of https://en.wikipedia.org/wiki/shadow_mapping

Shadow Mapping (Williams 1978) Q: Is the point that is seen by the camera visible to the light? A: The point is visible if: It s as close to the light as the closest primitive in the scene. In the light s coordinate system, the point s zz-coordinate equals the zz-coordinate of the primitive seen by the light. Rendering the scene from the light s perspective, the point s zz-coordinate equals the value stored in the zz-buffer. pp

Shadow Mapping (Williams 1978) Test if surface is visible to the light when computing the contribution the lighting equation. Render the scene from the camera's perspective and read back the zz-buffer/shadow map. Camera view (Directional) light view Images courtesy of https://en.wikipedia.org/wiki/shadow_mapping

Shadow Mapping (Williams 1978) Test if surface is visible to the light when computing the contribution the lighting equation. Render the scene from the camera's perspective and read back the zz-buffer/shadow map. For each pixel in the camera view, compute its coordinates relative to the light If it's further back than the value in the shadow map, it's in shadow Otherwise, it's illuminated Camera view Shadow map Images courtesy of https://en.wikipedia.org/wiki/shadow_mapping

Shadow Mapping (Williams 1978) Test if surface is visible to the light when computing the contribution the lighting equation. The projection used for rendering from the light-source depends on the type of light: Directional Orthographic Point Perspective Need to use multiple shadow maps if there are multiple lights in the scene Camera view Shadow map Images courtesy of https://en.wikipedia.org/wiki/shadow_mapping

Shadow Mapping (Williams 1978) Test if surface is visible to the light when computing the contribution the lighting equation. Perspective Aliasing: Stair-stepping due to limited shadow map resolution (particularly at grazing angles) Images courtesy of https://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx

Shadow Mapping (Williams 1978) Test if surface is visible to the light when computing the contribution the lighting equation. Perspective Aliasing: Stair-stepping due to limited shadow map resolution (particularly at grazing angles) Shadow Acne: Self-shadowing due to limited depth resolution Images courtesy of https://msdn.microsoft.com/en-us/library/windows/desktop/ee416324(v=vs.85).aspx

Midterm Content: Everything that we have covered up to this point: Image Processing Sampling Ray-Casting/Tracing Illumination Clipping Texture Mapping

Midterm Format: Closed book Short answer questions only No essays No true/false No multiple choice

Midterm Breakdown: Six Sections: Image Processing Sampling Ray Tracing Illumination Texture Mapping Miscellany