CSE528 Computer Graphics: Theory, Algorithms, and Applications

Similar documents
Surface Rendering. Surface Rendering

CS 5600 Spring

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E.

Texturing. Texture Mapping. Texture Mapping. Have seen: colour can be assigned to ver7ces But: don t want to represent all this detail with geometry

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Texture mapping. Computer Graphics CSE 167 Lecture 9

CPSC / Texture Mapping

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

Announcements. Written Assignment 2 is out see the web page. Computer Graphics

Texture Mapping II. Light maps Environment Maps Projective Textures Bump Maps Displacement Maps Solid Textures Mipmaps Shadows 1. 7.

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

3D Rasterization II COS 426

CS 431/636 Advanced Rendering Techniques

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

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

Buffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Programmable GPUS. Last Time? Reading for Today. Homework 4. Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

Computer Graphics. - Texturing Methods -

frame buffer depth buffer stencil buffer

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

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

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

Textures and normals in ray tracing

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 10

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

CS 130 Final. Fall 2015

Procedural Modeling. Last Time? Reading for Today. Reading for Today

Computer Graphics I Lecture 11

Complex Features on a Surface. CITS4241 Visualisation Lectures 22 & 23. Texture mapping techniques. Texture mapping techniques

CHAPTER 1 Graphics Systems and Models 3

CMSC427 Final Practice v2 Fall 2017

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

Introduction to Computer Graphics with WebGL

Computer Graphics 7 - Texture mapping, bump mapping and antialiasing

Topics and things to know about them:

The Traditional Graphics Pipeline

More Texture Mapping. Texture Mapping 1/46

The Traditional Graphics Pipeline

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

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

Shadows in the graphics pipeline

The Traditional Graphics Pipeline

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Homework #2. Shading, Ray Tracing, and Texture Mapping

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

Graphics Hardware and Display Devices

Real-Time Shadows. MIT EECS 6.837, Durand and Cutler

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Pipeline Operations. CS 4620 Lecture 14

Intro to Ray-Tracing & Ray-Surface Acceleration

Real-Time Shadows. Last Time? Schedule. Questions? Today. Why are Shadows Important?

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

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

Texturas. Objectives. ! Introduce Mapping Methods. ! Consider two basic strategies. Computação Gráfica

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

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

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

CS 354R: Computer Game Technology

Texture Mapping and Sampling

CS451Real-time Rendering Pipeline

Einführung in Visual Computing

03 RENDERING PART TWO

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Graphics for VEs. Ruth Aylett

CSE328 Fundamentals of Computer Graphics

Ray Tracing Basics I. Computer Graphics as Virtual Photography. camera (captures light) real scene. photo. Photographic print. Photography: processing

CS 464 Review. Review of Computer Graphics for Final Exam

CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Advanced Shading and Texturing

Graphics and Interaction Rendering pipeline & object modelling

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

Objectives. Texture Mapping and NURBS Week 7. The Limits of Geometric Modeling. Modeling an Orange. Three Types of Mapping. Modeling an Orange (2)

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

Reading. Texture Mapping. Non-parametric texture mapping. Texture mapping. Required. Angel, 8.6, 8.7, 8.9, 8.10,

CS5620 Intro to Computer Graphics

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

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

Texture Mapping. Brian Curless CSE 457 Spring 2016

Computergrafik. Matthias Zwicker. Herbst 2010

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Reading. Texture Mapping. Non-parametric texture mapping. Texture mapping. Required. Angel, 8.6, 8.7, 8.9, Recommended

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Texturing Theory. Overview. All it takes is for the rendered image to look right. -Jim Blinn 11/10/2018

Point based Rendering

Other Rendering Techniques CSE 872 Fall Intro You have seen Scanline converter (+z-buffer) Painter s algorithm Radiosity CSE 872 Fall

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

Interpolation using scanline algorithm

INF3320 Computer Graphics and Discrete Geometry

Barycentric Coordinates and Parameterization

lecture 18 - ray tracing - environment mapping - refraction

CS354 Computer Graphics Ray Tracing. Qixing Huang Januray 24th 2017

Texture Mapping. Reading. Implementing texture mapping. Texture mapping. Daniel Leventhal Adapted from Brian Curless CSE 457 Autumn 2011.

Triangle Rasterization

Texture. Detail Representation

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Transcription:

CSE528 Computer Graphics: Theory, Algorithms, and Applications Hong Qin State University of New York at Stony Brook (Stony Brook University) Stony Brook, New York 11794--4400 Tel: (631)632-8450; Fax: (631)632-8334 qin@cs.sunysb.edu http://www.cs.sunysb.edu/~qin

Texture Mapping for Computer Graphics

The Limitations of Geometric Modeling Although graphics cards can render over 10 million polygons per second, that number is insufficient for many phenomena Clouds Grass Terrain Skin

The Problem with Geometric Models We do not want to represent all of these details with geometry ONLY!!!

Texture Mapping: Basic Concept Increase the apparent complexity of simple geometry Like wallpapering or gift-wrapping with stretchy paper Curved surfaces require extra stretching or even cutting

Objectives and Topics Introduction of mapping methods Texture mapping Environment mapping Bump mapping Consider basic strategies Forward vs. backward mapping Point sampling vs. area averaging

Modeling an Orange (A Classical Example) Consider the problem of modeling an orange (the fruit) Start with an orange-colored sphere Too simple Replace sphere with a more complex shape Does not capture surface characteristics (small dimples) Takes too many polygons to model all the dimples

Modeling an Orange Take a picture of a real orange, scan it, and paste onto simple geometric model This process is known as texture mapping Still might not be sufficient because resulting surface will be smooth Need to change local shape Bump mapping

Texture Mapping A clever way of adding surface details Two ways can achieve the goal: Surface detail polygons: create more and more polygons to model object details Add scene complexity and thus slow down the graphics rendering performance Some fine features are hard to model! Map a texture to the surface (a more popular approach) Complexity of images does not affect the complexity of geometry processing (transformation, clipping )

Three Types of Mapping Texture mapping Uses images to fill inside of polygons Environment (reflection mapping) Uses a picture of the environment for texture maps Allows simulation of highly specular surfaces Bump mapping Emulates altering normal vectors during the rendering process

Texture Mapping geometric model Texture-mapped model

Environment Mapping

Environment Mapping Example

Bump Mapping

Where Does Mapping Take Place? Mapping techniques are implemented at the end of the rendering pipeline Very efficient because few polygons make it past the clipper

Is It Really Simple? Although the idea is simple - map an image to a surface - there are 3 or 4 coordinate systems involved 2D image 3D surface

Coordinate Systems Parametric coordinates May be used to model curves and surfaces Texture coordinates Used to identify points in the image to be mapped Object or world coordinates Conceptually, where the mapping takes place Window coordinates Where the final image is really produced

Texture Mapping parametric coordinates texture coordinates world coordinates window coordinates

Mapping Functions Basic problem is how to find the maps Consider mapping from texture coordinates to a point of a surface Appear to need three functions x = x(s,t) y = y(s,t) z = z(s,t) But we really want to go the other way t s (x,y,z)

Backward Mapping We really want to go backwards Given a pixel, we want to know to which point on an object it corresponds Given a point on an object, we want to know to which point in the texture it corresponds Need a map of the form s = s(x,y,z) t = t(x,y,z) Such functions are difficult to find in general

Map Textures to Surfaces Texture mapping is performed in rasterization (backward mapping) (0,1) (1,1) (0,0) (1,0) For each pixel that is to be painted, its texture coordinates (s, t) are determined (interpolated) based on the corners texture coordinates (why not just interpolate the color?) The interpolated texture coordinates are then used to perform texture lookup

Texture Mapping Pipeline 1. projection 3D geometry 2. texture lookup t 3. patch texel 2D projection of 3D geometry 2D image S

Texture Value Lookup For the given texture coordinates (s,t), we can find a unique image value from the texture map (1,1) How about coordinates that are not exactly at the intersection (pixel) positions? A) Nearest neighbor B) Linear Interpolation C) Other filters (0,0) (0.25,0) (0.5,0) (0.75,0) (1,0)

Texture Rasterization Texture coordinates are interpolated from polygon vertices just like remember line drawing Color : Gouraud shading Depth: Z-buffer First along polygon edges between vertices Then along scanlines between left and right sides from Hill

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

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

Linear Texture Coordinate Interpolation This doesn t work in perspective projection! The textures look warped along the diagonal Noticeable during an animation courtesy of H. Pfister

Why? Equal spacing in screen (pixel) space is not the same as in texture space in perspective projection Perspective foreshortening from Hill courtesy of H. Pfister

Visualizing the Problem Notice that uniform steps on the image plane do not correspond to uniform steps along the edge.

Perspective-Aware Texture Coordinate Interpolation Interpolate (tex_coord/w) over the polygon, then do perspective division after interpolation Compute at each vertex after perspective transformation Numerators s/w, t/w Denominator 1/w Linearly interpolate 1/w, s/w, and t/w across the polygon At each pixel Perform perspective division of interpolated texture coordinates (s/w, t/w) by interpolated 1/w (i.e., numerator over denominator) to get (s, t)

Perspective-Correct Interpolation That fixed it!

Common Texture Coordinate Mappings Orthogonal Cylindrical Spherical Perspective Projection Texture Chart

Map Textures to Surfaces The key question: Establish mapping from texture to surfaces (polygons): - Application program needs to specify texture coordinates for each corner of the polygon (1,0) (1,1) The polygon can be in an arbitrary size (0,0) (1,0)

Texture Mapping Difficulties Tedious to specify texture coordinates Acquiring textures is surprisingly difficult Photographs have projective distortions Variations in reflectance and illumination Tiling problems

Projector Functions How do we map the texture onto a arbitrary (complex) object? Construct a mapping between the 3-D point to an intermediate surface Idea: Project each object point to the intermediate surface with a parallel or perspective projection The focal point is usually placed inside the object Plane Cylinder Sphere Cube Planar projector

Planar Projector Orthographic projection onto XY plane: u = x, v = y...onto YZ plane...onto XZ plane courtesy of R. Wolfe

Two-part Mapping One solution to the mapping problem is to first map the texture to a simple intermediate surface Example: map to cylinder

Cylindrical Projector Convert rectangular coordinates (x, y, z) to cylindrical (r, µ, h), use only (h, µ) to index texture image

Cylindrical Mapping Parametric cylinder x = r cos 2p u y = r sin 2pu z = v/h maps rectangle in u,v space to cylinder of radius r and height h in world coordinates s = u t = v maps from texture space

Spherical Projector Convert rectangular coordinates (x, y, z) to spherical (, f) courtesy of R. Wolfe

Spherical Map We can use a parametric sphere x = r cos 2pu y = r sin 2pu cos 2pv z = r sin 2pu sin 2pv in a similar manner to the cylinder but have to decide where to put the distortion Spheres are used in environmental maps

Parametric Surfaces A parameterized surface patch x = f(u, v), y = g(u, v), z = h(u, v) You will get the mapping via parameterization courtesy of R. Wolfe

Box Mapping Easy to use with simple orthographic projection Also used in environment maps

What's the Best Chart?

Second Mapping Map from intermediate object to actual object Normals from intermediate to actual Normals from actual to intermediate Vectors from center of intermediate actual intermediate

Projective Textures Use the texture like a slide projector No need to specify texture coordinates explicitly A good model for shading variations due to illumination A fair model for reflectance (can use pictures)

Projective Texture Example Modeling from photographs Using input photos as textures

Texture Tiling Specify a texture coordinate (u,v) at each vertex Canonical (0,3) texture coordinates (0,3)(0,0) (1,1) (1,1) (1,1) (0,0) (0,0) (0,0) (3,0) tiles with visible seams (0,0) (3,0) seamless tiling (repeating)

Specify More Coordinates? We can reduce the perceived artifacts by subdividing the model into smaller triangles. However, sometimes the errors become obvious At "T" joints Between levels-of-details

Subdivision

Subdivision texture source what we get what we want

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

Texture Chart Pack triangles into a single image

Procedural and Solid Textures

Procedural Textures f (x,y,z) color

Procedural Textures f (x,y,z) color Image by Turner Whitted

Procedural Textures Advantages: easy to implement in ray tracer more compact than texture maps especially for solid textures infinite resolution Disadvantages non-intuitive difficult to match existing texture

Solid Texture Examples

Procedural Solid Textures Noise Turbulence

What's Missing? What's the difference between a real brick wall and a photograph of the wall texture-mapped onto a plane? What happens if we change the lighting or the camera position?

Bump Mapping Other Mapping Techniques: Bump Mapping Displacement Mapping

Remember Gouraud Shading? Instead of shading with the normal of the triangle, shade the vertices with the average normal and interpolate the color across each face

Phong Normal Interpolation Interpolate the average vertex normals across the face and compute per-pixel shading Must be renormalized

Bump Mapping Use textures to alter the surface normal Does not change the actual shape of the surface Just shade as if it were a different shape Sphere w/diffuse Texture Swirly Bump Map Sphere w/diffuse Texture & Bump Map

Bump Mapping Treat the texture as a single-valued height function Compute the normal from the partial derivatives in the texture

Another Bump Map Example Bump Map Cylinder w/diffuse Texture Map Cylinder w/texture Map & Bump Map

What's Missing? There are no bumps on the silhouette of a bump-mapped object Bump maps don t allow self-occlusion or self-shadowing

Displacement Mapping Use the texture map to actually move the surface point The geometry must be displaced before visibility is determined

Displacement Mapping Image from: Geometry Caching for Ray-Tracing Displacement Maps by Matt Pharr and Pat Hanrahan. note the detailed shadows cast by the stones

Displacement Mapping Ken Musgrave

Environment Maps We can simulate reflections by using the direction of the reflected ray to index a spherical texture map at "infinity". Assume that all reflected rays begin from the same point.

Illumination + Texture Mapping

Texture Maps for Illumination Also called "Light Maps" Quake

Questions?