Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.

Slides:



Advertisements
Similar presentations
Lecture 8 Transparency, Mirroring
Advertisements

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 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Texture Mapping. Typical application: mapping images on geometry 3D geometry (quads mesh) + RGB texture 2D (color-map) =
Computer Graphics Bing-Yu Chen National Taiwan University.
Tuesday February 19 th, 2002 Deep Shadow Maps Tom Lokovic & Eric Veach Pixar Animation Studios Presented by Tom Lechner.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
Advanced Texture and Lighting
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Texture Mapping II April 10, 2003.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
Computer Graphics (Spring 2008) COMS 4160, Lecture 19: Texture Mapping Many slides from Greg Humphreys, UVA and Rosalee.
(conventional Cartesian reference system)
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Texture Mapping.
Status – Week 277 Victor Moya.
Approximate Soft Shadows on Arbitrary Surfaces using Penumbra Wedges Tomas Akenine-Möller Ulf Assarsson Department of Computer Engineering, Chalmers University.
Advanced Texture Mapping May 10, Today’s Topics Mip Mapping Projective Texture Shadow Map.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
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: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Computer Graphics Texture Mapping
11/11/04© University of Wisconsin, CS559 Fall 2004 Last Time Shading Interpolation Texture mapping –Barycentric coordinates for triangles.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Lecture 3 : Direct Volume Rendering Bong-Soo Sohn School of Computer Science and Engineering Chung-Ang University Acknowledgement : Han-Wei Shen Lecture.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Interactive Rendering of Meso-structure Surface Details using Semi-transparent 3D Textures Vision, Modeling, Visualization Erlangen, Germany November 16-18,
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Computer Graphics 2 Lecture 8: Visibility Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
Rendering Fake Soft Shadows with Smoothies Eric Chan Massachusetts Institute of Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
OpenGL Graphics Textures. Quiz You didn't see that coming!
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
CSCI 440.  So far we have learned how to  build shapes  create movement  change views  add simple lights  But, our objects still look very cartoonish.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Module 06 –environment mapping Module 06 – environment mapping Module 06 Advanced mapping techniques: Environment mapping.
Module 05 –Bump mapping Module 05 – Bump mapping Module 05 Advanced mapping techniques: Bump mapping.
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.
Texture Mapping cgvr.korea.ac.kr.
3D Graphics Rendering PPT By Ricardo Veguilla.
Bump Mapping -1 Three scales of detail on an object
The Graphics Rendering Pipeline
Interactive Graphics Algorithms Ying Zhu Georgia State University
Lecture 13 Clipping & Scan Conversion
CS-378: Game Technology Lecture #4: Texture and Other Maps
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Texture Mapping Jung Lee.
Presentation transcript:

Computer Graphics 2 Lecture 7: Texture Mapping Benjamin Mora 1 University of Wales Swansea Pr. Min Chen Dr. Benjamin Mora

Content 2 Benjamin Mora University of Wales Swansea Texture Mapping at the very beginning. Perspectively Correct Texture Mapping. Texture Filtering. Muti-Texturing. Texture Mapping as an n-Dimensional function. Other use of Texture Mapping. –Spherical and Cube mapping. –Shadow Mapping –Bump Mapping

Texture Mapping at the very beginning 3 Benjamin Mora University of Wales Swansea

Texture Mapping 4 Benjamin Mora University of Wales Swansea

Texture Mapping 5 Benjamin Mora University of Wales Swansea

Texture Mapping 6 Benjamin Mora University of Wales Swansea Initial Goal: Get surfaces that are more consistent by mapping images (textures) on the primitives of the scene. Usually 2D, but textures can also be 1D or 3D. For every vertex, the programmer must specify their coordinates inside the texture image.

Texture Mapping Coordinates 7 Benjamin Mora University of Wales Swansea n-Dimensional (Usually 2D) Texture coordinates are provided for every vertex of the 3D Mesh. –Coordinates usually considered between 0 and 1. Texture coordinates are then linearly interpolated inside the triangle at the intersection point. Rasterization Linear Interpolation p0p0 v dir p(t) Ray-tracing

Texture Mapping Coordinates 8 Benjamin Mora University of Wales Swansea Texture (0.5, 1) (0, 0) (1, 1) (1, 0) (0, 0) (0.5, 0.333)

Linear Interpolation inside a simplex 9 Benjamin Mora University of Wales Swansea Simplex= A n-dimensional generalization of a triangle. –n=1 => a line. –n=2 => a triangle. –n=3 => a tetrahedron. Linear Interpolation inside a triangle: γ f 123 = (1- γ) f 12 + γ f 13 0 ≤ α, β, γ ≤ 1 f1f1 f2f2 f 12 f 13 f 123 α β f 12 = (1- α) f 1 + α f 2 f 13 = (1- β) f 1 + β f 3 f3f3

Linear Interpolation inside a simplex 10 Benjamin Mora University of Wales Swansea Properties –The weights of f1,f2,f3 represent the barycentric coordinates. –The set of points having the same interpolated value (isosurface) represents a line –Extension to 3D (tetrahedron) is trivial The set of points having the same interpolated value (isosurface) represents a plane f 123 =((1- α)(1-γ)+(1- β)γ ) f 1 + (α)(1-γ) f 2 + βγ f 3 f 123 =a 1 f 1 +a 2 f 2 +a 3 f 3, with a 1 +a 2 +a 3 = Isosurface (f=5)

Texture Mapping on graphics cards 11 Benjamin Mora University of Wales Swansea OpenGL interpolates the texture coordinates for every rasterized fragment and then fetch the pixel from the texture. Textures are stored on the graphics board memory and are highly optimized. –Huge memory bandwidth thanks to specialized hardware.

Perspectively correct Texture Mapping 12 Benjamin Mora University of Wales Swansea

Issue With Graphics Hardware TM 13 Benjamin Mora University of Wales Swansea Ray-Tracing interpolates texture coordinates at the (3D) intersection. Basic Graphics Hardware would project the triangle first on the image plane, and then linearly interpolate coordinates & color. –Incorrect due to the non-linearity aspect of perspective projection. Image Plane v dir View Point Distance Ratio=0.5 Distance Ratio!=0.5

Issue With Graphics Hardware TM Correct coordinate Interpolation: Biased estimation: 14 Benjamin Mora University of Wales Swansea View Point α p 2 (u 2, z 2 ) p 1 (u 1, z 1 ) A texture coordinate Vertex Depth

Texture Filtering 15 Benjamin Mora University of Wales Swansea

Texture MIP-Mapping 16 Benjamin Mora University of Wales Swansea Mipmap textures are used to decrease the bandwidth required to load the texture and to improve cache coherence. Can also improve quality for objects that are far away. Pixels

Texture MIP-Mapping 17 Benjamin Mora University of Wales Swansea Mipmaps can be automatically generated or specified by the programmer. Texture are always magnified or minified. Bilinear, trilinear or anisotropic filtering helps when the texture is magnified. Issue with MIP-Mapping: –Transition between Mipmap levels can be visible inside the image. –Tri-linear texture filtering reduces the artefact by interpolating texels from the 2 closest mipmap levels.

Texture MIP-Mapping 18 Benjamin Mora University of Wales Swansea

Texture MIP-Mapping 19 Benjamin Mora University of Wales Swansea

Multi-Texturing 20 Benjamin Mora University of Wales Swansea

Multi-Texturing: Example 21 Benjamin Mora University of Wales Swansea *

Multi-Texturing 22 Benjamin Mora University of Wales Swansea Multiple ways to blend textures. –Originally additive or multiplicative was supported on Graphics hardware. –Arbitrary blending is now possible on Graphics hardware with the use of fragments program. Every advanced game/software nowadays makes use of Multitexturing. –See next slides…

Texture Mapping as an n- Dimensional function 23 Benjamin Mora University of Wales Swansea

TM as an n-Dimensional function 24 Benjamin Mora University of Wales Swansea Concept of texturing can be extended, and textures can be 1D, 2D, 3D. A texture can be seen as a way to represent a 1D, 2D or 3D function. –f(x), f(x,y), f(x,y,z). –Bounded interval (eg. [0..1, 0..1] in 2D). –Regular interval sampling. Can be used to represent anything… –Vertex displacement. –Noise. –Shading function (E.G., BRDFs).

1D Textures 25 Benjamin Mora University of Wales Swansea Useful for representing things like –Hair and line texturing. –1D functions not implemented on hardware E.g. ArcTan. –Look-up tables. –Arbitrary data in 1D arrays.

3D Textures 26 Benjamin Mora University of Wales Swansea Useful for representing things like –Marble –Fire –Fog –Fur From NVidia Demo, Werewolf

3D Textures 27 Benjamin Mora University of Wales Swansea Volume Rendering applications –Medical datasets

Other use of Texture Mapping 28 Benjamin Mora University of Wales Swansea

Environment mapping 29 Benjamin Mora University of Wales Swansea Useful for simulating/faking reflections & refractions –Proposed by Blinn and Newell. The coordinates of the normal on two axes perpendicular to the view direction are used as texture coordinates. Spherical mapping. –single image used Cube mapping. –6 faces of a cube represent a cube map texture. –More accurate than spherical mapping.

Environment mapping 30 Benjamin Mora University of Wales Swansea Spherical mapping. (a single image)

Environment mapping 31 Benjamin Mora University of Wales Swansea Cube Mapping Textures Provided by NVidia

Shadow Mapping 32 Benjamin Mora University of Wales Swansea A way to provide more or less accurate shadows An alternative to shadow volumes for shadows on graphics hardware. –Not seen in this course.

Shadow Mapping 33 Benjamin Mora University of Wales Swansea With ShadowsWithout Shadows Cass Everitt, Ashu Rege and Cem Cebenoyan. Hardware Shadow Mapping. Available at:

Shadow Mapping 34 Benjamin Mora University of Wales Swansea From Mark Kilgard’s shadow mapping presentation at GDC Cass Everitt, Ashu Rege and Cem Cebenoyan. Hardware Shadow Mapping. Available at:

Shadow Mapping 35 Benjamin Mora University of Wales Swansea Figure 2. A shadow mapped scene rendered from the eye’s point of view (left), the scene as rendered from the light’s point of view (center), and the corresponding depth/shadow map (right). Cass Everitt, Ashu Rege and Cem Cebenoyan. Hardware Shadow Mapping. Available at:

Shadow Mapping 36 Benjamin Mora University of Wales Swansea Figure 5. A very low resolution shadow map is used to demonstrate the difference between nearest (left) and linear (right) filtering for shadow maps. Credit: Mark Kilgard. Cass Everitt, Ashu Rege and Cem Cebenoyan. Hardware Shadow Mapping. Available at:

Shadow Mapping 37 Benjamin Mora University of Wales Swansea Render an image (Shadow map) from the viewpoint. The theoretical position of every pixel in the final image is then compared to the actual shadow map value. (To test its visibility from the light source). The algorithm must allow for a small margin error in the computation. Produce aliasing at the penumbra border. Use of high- resolution map is required. The scene is rendered once per light source. Simpler than volumetric shadows.

Bump Mapping 38 Benjamin Mora University of Wales Swansea Idea (Blinn): Modifying the normal vector of an object before shading to add details to the surface. The perturbation can be procedural (vertex programs or fragment programs) or texture-based. Blinn, James F. Simulation of Wrinkled Surfaces, Computer Graphics, Vol. 12 (3), pp SIGGRAPH-ACM (August. 1978).