Texturing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.

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

03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
CSE 681 Texture mapping - other methods Environmental mapping Bump mapping.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Texture Mapping CMSC435 UMBC *With lots of borrowing from the usual victims…
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.
3D Graphics for Game Programming (J. Han) Chapter VIII Image Texturing.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
Sampling, Aliasing, & Mipmaps
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
(conventional Cartesian reference system)
CSC345: Advanced Graphics & Virtual Environments
Graphics Presented by Shuang Li. 2 Overview  Fundamentals  High-Level Organization  Rendering Primitives  Textures  Lighting  The Hardware Rendering.
Shading Adding Color Lambert’s law n L  Light a point in any direction varies as the cosine of the angle between a vector from the point to the light.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
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.
3D Computer Graphics: Textures. Textures: texels Texture is a way of assigning a diffuse color to a pixel – can be with 1, 2 or 3D- can use maps, interpolation.
Week 8 - Monday.  What did we talk about last time?  Workday  Before that:  Image texturing ▪ Magnification ▪ Minification  Mipmapping  Summed area.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
Environment Mapping. Examples Fall Motivation Silver candlestick No appropriate texture for it “ environment ” map Simulates the results of ray-tracing.
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.
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Mapping method Texture Mapping Environmental mapping (sphere mapping) (cube mapping)
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.
Texture Mapping Applications 2. Parallax Mapping with Slope  parallax mapping assumes that the surface is a single plane  a better approximation  surface.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Photo-realistic Rendering and Global Illumination in Computer Graphics Spring 2012 Texturing K. H. Ko School of Mechatronics Gwangju Institute of Science.
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
Texture Mapping May 4, Many slides are borrowed from UNC-CH COMP236 Course (Spring 2003) taught by Leonard McMillan
CS 450: COMPUTER GRAPHICS TEXTURE MAPPING SPRING 2015 DR. MICHAEL J. REALE.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
Mapping: Image Texturing CPSC 591/691. Texture Mapping Two-dimensional techniques place a two-dimensional (flat) image onto an object using methods similar.
Texturing CMSC 435/ What is Texturing? 2 Texture Mapping Definition: mapping a function onto a surface; function can be: – 1, 2, or 3D – sampled.
Antialiasing. What is alias? Alias - A false signal in telecommunication links from beats between signal frequency and sampling frequency (from dictionary.com)
- Introduction - Graphics Pipeline
Week 7 - Wednesday CS361.
Texture Mapping Fall, 2016.
CENG 477 Introduction to Computer Graphics
Texture Mapping cgvr.korea.ac.kr.
Visual Appearance Chapter 4
Sampling Theorem & Antialiasing
CS451Real-time Rendering Pipeline
*With lots of borrowing from the usual victims…
Interactive Graphics Algorithms Ying Zhu Georgia State University
3D Game Programming Texture Mapping
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Texture mapping - other methods
OpenGL Texture Mapping
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Environment Mapping.
Simple Texture Mapping
3D Game Programming Texture Mapping
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Texture Mapping Jung Lee.
Presentation transcript:

Texturing Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

Tomas Akenine-Mőller © 2002 Texturing: Glue n-dimensional images onto geometrical objects Purpose: more realism, and this is a cheap way to do it – Bump mapping – Plus, we can do environment mapping – And other things We use triangles in real-time rendering, why? – Interpolation is rotation-invariant! – Not so for quadrilaterals. + =

Tomas Akenine-Mőller © 2002 Texture coordinates What if (u,v) >1.0 or <0.0 ? To repeat textures, use just the fractional part – Example: 5.3 -> 0.3 Repeat, mirror, clamp, border: (0,0)(1,0) (1,1)(0,1) (u,v) in [0,1] (u 0,v 0 ) (u 1,v 1 ) (u 2,v 2 ) (-1,-1) (2,2)

Tomas Akenine-Mőller © 2002 Texture magnification What does the theory say… sinc(x) is not feasible in real time Box filter (nearest-neighbor) is Poor quality

Tomas Akenine-Mőller © 2002 Texture magnification Tent filter is feasible! Linear interpolation Looks better Simple in 1D: (1-t)*color0+t*color1 How about 2D?

Tomas Akenine-Mőller © 2002 Bilinear interpolation Texture coordinates (p u,p v ) in [0,1] Texture images size: n*m texels Nearest neighbor would access: ( floor(n*u), floor(m*v) ) Interpolate 1D in x & y

Tomas Akenine-Mőller © 2002 Bilinear interpolation Check out this formula at home t(u,v) accesses the texture map b(u,v) filtered texel

Tomas Akenine-Mőller © 2002 Texture minification What does a pixel ”see”? Theory (sinc) is too expensive Cheaper: average of texel inside a pixel Still too expensive, actually Mipmaps – another level of approximation – Prefilter texture maps as shown on next slide

Tomas Akenine-Mőller © 2002 Mipmapping Image pyramid Half width and height when going upwards Average over 4 ”parent texels” to form ”child texel” Depending on amount of minification, determine which image to fetch from Compute d first, gives two images – Bilinear interpolation in each u v d

Tomas Akenine-Mőller © 2002 Mipmapping Interpolate between those bilinear values – Gives trilinear interpolation Constant time filtering: 8 texel accesses How to compute d ? v u d Level n+1 Level n (u0,v0,d0)(u0,v0,d0)

Tomas Akenine-Mőller © 2002 Computing d for mipmapping Approximate quad with square Gives overblur! Even better: anisotropic texture filtering – Approximate quad with several smaller mipmap samples pixel projected to texture space texel

Tomas Akenine-Mőller © 2002 Anisotropic texture filtering 16 samples

Tomas Akenine-Mőller © 2002 Mipmapping: Memory requirements Not twice the number of bytes…! Rather 33% more – not that much

Tomas Akenine-Mőller © 2002 Miscellaneous How to apply texturing: – Modulate (multiply texture with lighting) – Replace (just use texture color) – Add, sub, etc (on newer hardware) – More in the book

Tomas Akenine-Mőller © 2002 Environment mapping Assumes the environment is infinitely far away Sphere mapping treated in other course – Or see book. [Note: available on old computers…] Cube mapping is the norm nowadays – Advantages: no singularities as in sphere map – Much less distortion – Gives better result – Not dependent on a view position

Tomas Akenine-Mőller © 2002 x y z Cube mapping Simple math: compute reflection vector, r Largest abs-value of component, determines which cube face. – Example: r=(5,-1,2) gives POS_X face Divide r by 5 gives (u,v)=(-1/5,2/5) If your hardware has this feature, then it does all the work n eye

Tomas Akenine-Mőller © 2002 Bump mapping by Blinn in 1978 Inexpensive way of simulating wrinkles and bumps on geometry – Too expensive to model these geometrically Instead let a texture modify the normal at each pixel, and then use this normal to compute lighting geometry Bump map Stores heights: can derive normals + Bump mapped geometry =

Tomas Akenine-Mőller © 2002 Bump mapping lighting Diffuse: n. l Specular: (n. h) m Assume directional lights Diffuse: fetch per pixel normal from bumpmap – Then compute per-pixel dot product with lightvector (constant) Specular: h is (assumed) constant for dir. lights – compute per-pixel dot product with normal from bumpmap – Gives (n. h), then (n. h) 2, (n. h) 4, (n. h) 8 How store normals in texture (bump map) n=(n x, n y, n z ) are in [-1,1] Add 1, mult 0.5: in [0,1] Mult by 255 (8 bit per color component) Can be stored in texture:

Tomas Akenine-Mőller © 2002 Bump mapping: example Other ways to do bump mapping on – These are less expensive, and feasible on cheaper hardware – See book

Tomas Akenine-Mőller © 2002 Other 3D textures: – Feasible on modern hardware as well – Texture filtering is no longer trilinear – Rather quadlinear (linear interpolation 4 times) – Enables new possibilities Can store light in a room, for example Multitexturing – More than one set of texture coords per vertex – The output from the first texture stage is input to the next – Opens up for many possibilities