Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.

Slides:



Advertisements
Similar presentations
Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
Advertisements

Michael I. Gold NVIDIA Corporation
Exploration of bump, parallax, relief and displacement mapping
Bump Mapping CSE 781 Roger Crawfis.
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 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
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.
Texture Mapping. Typical application: mapping images on geometry 3D geometry (quads mesh) + RGB texture 2D (color-map) =
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
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.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
HCI 530 – Seminar in Advanced Topics 10/8/2004Damian Schofield1 Texturing Based on 3D Rendering, Humphreys, G., University of Virginia, 2004.
(conventional Cartesian reference system)
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Computer Graphics Shadows
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.
1 Texture. 2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures.
Week 8 - Monday.  What did we talk about last time?  Workday  Before that:  Image texturing ▪ Magnification ▪ Minification  Mipmapping  Summed area.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
ECSE 4750: Computer Graphics Rensselaer Polytechnic Institute Nov 5, 2012 Texture and Texture Mapping.
Computer Graphics Texture Mapping
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 고려대학교 컴퓨터 그래픽스 연구실.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
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.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
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.
Game Programming 06 The Rendering Engine
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.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
CS 450: COMPUTER GRAPHICS TEXTURE MAPPING SPRING 2015 DR. MICHAEL J. REALE.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003.
CSc4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Texture Mapping.
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
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.
Discrete Techniques.
Week 7 - Wednesday CS361.
Week 7 - Monday CS361.
Texture Mapping cgvr.korea.ac.kr.
3D Graphics Rendering PPT By Ricardo Veguilla.
Bump Mapping -1 Three scales of detail on an object
Interactive Graphics Algorithms Ying Zhu Georgia State University
UMBC Graphics for Games
CS-378: Game Technology Lecture #4: Texture and Other Maps
Chapter XV Shadow Mapping
Advanced Computer Graphics: Texture
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Presentation transcript:

Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency

Computer Graphics Inf4/MSc 2 Today Texture mapping –Anti-aliasing techniques Bump mapping Transparency

Computer Graphics Inf4/MSc 3 Aliasing Happens when –The camera is zoomed too much into the textured surface (magnification)‏ –Several texels covering a pixel’s cell (minification)‏

Computer Graphics Inf4/MSc 4 Texture Magnification Zooming into a surface with a texture too much One texel covering many pixels

Computer Graphics Inf4/MSc 5 Texture Magnification Methods to determine the color of each pixel –Nearest neighbour (using the colour of the closest texel)‏ –Bilinear interpolation (linearly interpolating the colours of the surrounding texels) – NN BI

Computer Graphics Inf4/MSc 6 Bilinear Interpolation –(pu,pv) : the pixel centre mapped into the texture space –b(pu,pv) : the colour at point pu, pv –t(x,y) : the texel colour at (x,y) –u = pu – (int)pu, v = pv - (int)pv

Computer Graphics Inf4/MSc 7 Texture Minification Many texels covering a pixel’s cell Results in aliasing (remember Nyquist limit)‏ The artifacts are even more noticeable when the surface moves Solution –Mipmapping

Computer Graphics Inf4/MSc 8 MIP map Multum In Parvo = Many things in a small place Produce a texture of multiple resolutions Switch the resolution according to the number of texels in one pixel Select a level that the ratio of the texture and the pixel is 1:1

Computer Graphics Inf4/MSc 9 Selecting the resolution in Mipmap Map the pixel corners to the texture space Find the resolution that roughly covers the mapped quadrilateral Apply a bilinear interpolation in that resolution, Or find the two surrounding resolutions and apply a trilinear interpolation (also along the resolution axis)‏

Computer Graphics Inf4/MSc 10 Texture Minification Multiple textures in a single pixel Solution: –Nearest neighbour Bilinear blending Mipmapping

Computer Graphics Inf4/MSc 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?

Computer Graphics Inf4/MSc Bump Mapping Use textures to alter the surface normal –Does not change the actual shape of the surface –Just shaded as if it were a different shape Sphere w/Diffuse Texture Swirly Bump Map Sphere w/Diffuse Texture & Bump Map

Computer Graphics Inf4/MSc Bump Mapping Treat the texture as a single-valued height function Compute the normal from the partial derivatives in the texture Do the lighting computation per pixel

Computer Graphics Inf4/MSc Another Bump Map Example Cylinder w/Diffuse Texture Map Bump Map Cylinder w/Texture Map & Bump Map

Computer Graphics Inf4/MSc Computing the normals n the normal vector at the surface n’ the updated normal vector Pu, Pv are partial derivatives of the surface in the u and v direction Fu, Fv are the gradients of the bump map along the u and v axes in the bump texture

Computer Graphics Inf4/MSc Computing Pu and Pv Do this for every triangle: v1,v2,v3 : 3D coordinates c1,c2,c3 : texture coordinates studios.dk/projects/downloads/tangent_matrix_derivation.ph p

Computer Graphics Inf4/MSc Some more examples

Computer Graphics Inf4/MSc Some more examples

Computer Graphics Inf4/MSc Some more examples

Computer Graphics Inf4/MSc Emboss Bump Mapping Real bump mapping uses per-pixel lighting Lighting calculation at each pixel based on perturbed normal vectors Computationally expensive Emboss bump mapping is a hack Diffuse lighting only, no specular component Can use per vertex lighting Less computation

Computer Graphics Inf4/MSc Diffuse Lighting Calculation C = (LN)  Dl  Dm L is light vector N is normal vector Dl is light diffuse color Dm is material diffuse color Bump mapping changes N per pixel Emboss bump mapping approximates (LN)

Computer Graphics Inf4/MSc Approximate diffuse factor LN Texture map represent height field [0,1] height represents range of bump function First derivative represents slope m m increases/decreases base diffuse factor Fd (Fd+m) approximates (LN) per pixel

Computer Graphics Inf4/MSc Compute the Bump Original bump (H0) overlaid with second bump (H1) perturbed toward light source Original bump (H0) Subtract original bump from second (H1-H0) brightens image darkens image

Computer Graphics Inf4/MSc Approximate derivative Embossing approximates derivative Lookup height H0 at point (s,t) Lookup height H1 at point slightly perturbed toward light source (s+  s, t+  t) subtract original height H0 from perturbed height H1 difference represents instantaneous slope m=H1- H0

Computer Graphics Inf4/MSc Compute the Lighting Evaluate fragment color Cf Cf = (LN)  Dl  Dm (LN)  (Fd + (H1-H0)) Dm  Dl encoded in surface texture color Ct Cf = (Fd + (H1-H0))  Ct

Computer Graphics Inf4/MSc Required Operations Calculate texture coordinate offsets  s,  t Calculate diffuse factor Fd Both are derived from normal N and light vector L Only done per vertex Computation of H1-H0 done per pixel

Computer Graphics Inf4/MSc Calculate Texture Offsets Rotate light vector into normal space Need Normal coordinate system Derive coordinate system from normal and “up” vector Normal is z-axis Cross product is x-axis Throw away up vector, derive y-axis as cross product of x- and z-axes Build 3x3 matrix from axes Transform light vector into Normal space

Computer Graphics Inf4/MSc Transforming the coordinates

Computer Graphics Inf4/MSc Calc Texture Offsets (cont’d) Use normal-space light vector for offsets L’ = T(L) : T is the transformation Use L’x, L’y for  s,  t Use L’z for diffuse factor (Fd) If light vector is near normal, L’x, L’y are small If light vector is near tangent plane, L’x and L’y are large  s,  t L’

Computer Graphics Inf4/MSc What's Missing? There are no bumps on the silhouette of a bump-mapped object

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

Computer Graphics Inf4/MSc 32 Transparency Sometimes we want to render transparent objects We blend the colour of the objects along the same ray Apply alpha blending

Computer Graphics Inf4/MSc 33 Alpha Another variable called alpha is defined here This describes the opacity Alpha = 1.0 means fully opaque Alpha = 0.0 means fully transparent α = 1 α = 0.5 α = 0.2

Computer Graphics Inf4/MSc 34 Sorting by the depth First, you need to save the depth and colour of all the fragments that will be projected onto the same pixel in a list Then blend the colour from back towards the front The colours of overlapping fragments are blended as follows: C o = α C s + (1-α) C d C s : colour of the transparent object, C d is the pixel colour before blending, C o is the new colour as a result of blending Do this for all the pixels

Computer Graphics Inf4/MSc Sorting the fragment data by the depth – use stl::sort #include struct FragInfo { float z; float color[3]; }; bool PixelInfoSortPredicate(const PixelInfo * d1, const PixelInfo * d2)‏ { return d1->z z; } main()‏ { FragInfo f1,f2,f3; f1.z = 1; f2.z = -2; f3.z = -5 vector flist ; flist.push_back(f1); flist.push_back(f2) ; flist.push_back(f3); std::sort(flist.begin(), flist.end(), PixelInfoSortPredicate); }

Computer Graphics Inf4/MSc 36 Readings Blinn, "Simulation of Wrinkled Surfaces", Computer Graphics, (Proc. Siggraph), Vol. 12, No. 3, August 1978, pp Real-time Rendering, Chapter 5, studios.dk/projects/downloads/tangent_matri x_derivation.phphttp:// studios.dk/projects/downloads/tangent_matri x_derivation.php ump_mapping.html