CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.

Slides:



Advertisements
Similar presentations
Projective Texture Mapping
Advertisements

3D Graphics Rendering and Terrain Modeling
OpenGL Texture Mapping
David Luebke5/16/2015 Administrivia l Back on track: canceling OpenGL lecture 2 l Assignment 1 –Greg Yukl found an alternate XForms site:
Rendering with Environment Maps Jaroslav Křivánek, KSVI, MFF UK
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
Advanced Texture and Lighting
Advanced Computer Graphics (Fall 2010) CS 283, Lecture 16: Image-Based Rendering and Light Fields Ravi Ramamoorthi
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.
Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 18: Shading & Texture Mapping Many slides from Greg.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Texture Mapping.
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz
ADDITIONAL TIPS Multi-texture Slides. Here is a link Workflow: /**************In texture parameter set up******/ call glActiveTextureARB(/*pick texture.
OpenGL Texture Mapping April 16, Angel: Interactive Computer Graphics 3E © Addison-Wesley 2002 Basic Stragegy Three steps to applying a texture.
CS 4731: Computer Graphics Lecture 17: Texturing Emmanuel Agu.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008.
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
Advanced Texturing Methods Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 8, 2003.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Texture Mapping. To add surface details… World of Warcraft, Blizzard Inc. More polygons (slow and hard to handle small details) Less polygons but with.
Advanced Computer Graphics (Spring 2013) CS 283, Lecture 15: Image-Based Rendering and Light Fields Ravi Ramamoorthi
Computer Graphics Texture Mapping Eriq Muhammad Adams
CS 638, Fall 2001 Admin Grad student TAs may have had their accounts disabled –Please check and the lab if there is a problem If you plan on graduating.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Texture Mapping.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Computer Graphics. Requirements Prerequisites Prerequisites CS 255 : Data Structures CS 255 : Data Structures Math 253 Math 253 Experience with C Programming.
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Shading & Texture. Shading Flat Shading The process of assigning colors to pixels. Smooth Shading Gouraud ShadingPhong Shading Shading.
Texture Mapping (cont.) Jian Huang, CS 594, updated in Fall’08.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
CS380 LAB IV OpenGL Jonghyeob Lee Reference1. [OpenGL course slides by Rasmus Stenholt] Reference2. [
Lecture 27: Texture Mapping Li Zhang Spring 2008
Texture Mapping. 2 Motivation A typical modern graphics card can handle 10s of millions of polygons a second. How many individual blades of grass are.
OpenGL Texture Mapping. 2 Objectives Introduce the OpenGL texture functions and options.
CS 480/680 Computer Graphics OpenGL Texture Mapping Dr. Frederick C Harris, Jr. Fall 2011.
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
TEXTURES & OTHER GOODIES Computer Graphics. glTexCoord2f(...); + =
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
October 9, 2002Serguei A. Mokhov, 1 COMP471 – Computer Graphics OpenGL: Texture Mapping.
CS559: Computer Graphics Lecture 8: Warping, Morphing, 3D Transformation Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
CS559: Computer Graphics Lecture 22: Texture mapping Li Zhang Spring 2010 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
CS559: Computer Graphics Lecture 20: Project 2 Review and Texture mapping Li Zhang Spring 2010 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys,
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
CS559: Computer Graphics Lecture 21: Subdivision, Bspline, and Texture mapping Li Zhang Spring 2008.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
Texture Coordinates CS418 Computer Graphics John C. Hart.
Module 05 –Bump mapping Module 05 – Bump mapping Module 05 Advanced mapping techniques: Bump mapping.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Texture Mapping Greg Humphreys University of Virginia CS 445, Fall 2003.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Administrivia Back on track: canceling OpenGL lecture 2 Assignment 1
CSE 167 [Win 17], Lecture 18: Texture Mapping Ravi Ramamoorthi
Assignment 3b Q&A.
Lecture 21: Texture mapping Li Zhang Spring 2010
3D Game Programming Texture Mapping
Textures II Week 10, Mon Mar 22
Programming Textures Lecture 15 Fri, Sep 28, 2007.
3D Game Programming Texture Mapping
Presentation transcript:

CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee Wolfe, DePaul tutorial teaching texture mapping visually, Jingyi Yu, U Kentucky.

Today Continue on Texture mapping Reading – Redbook: Ch 9, Ch 6 (Blending only) – (highly recommended) Moller and Haines: Real-Time Rendering, 3e, Ch 6 Linux: /p/course/cs559- lizhang/public/readings/6_texture.pdf Windows: P:\course\cs559- lizhang\public\readings\6_texture.pdf – (optional) Shirley: Ch 11.4 – 11.8

Projective (slide projector) Texture GL_OBJECT_LINEAR vs GL_EYE_LINEAR

Bump map vs Displacement map Figure 6.24 and 30 from RTR book

Displacement map in a scene

Solid textures – Use model-space coordinates to index into a 3D texture – Like “carving” the object from the material One difficulty of solid texturing is coming up with the textures.

Solid textures (cont'd) Here's an example for a vase cut from a solid marble texture: Solid marble texture by Ken Perlin

Environment Maps Images from Illumination and Reflection Maps: Simulated Objects in Simulated and Real Environments Gene Miller and C. Robert Hoffman SIGGRAPH 1984 “Advanced Computer Graphics Animation” Course Notes

8/10/2015Lecture 209 Environment Maps Instead of using transformed vertices to index the projected texture', we can use transformed surface normal s to compute indices into the texture map. These sorts of mapping can be used to simulate reflections, and other shading effects. This approach is not completely accurate. It assumes that all reflected rays begin from the same point, and that all objects in the scene are the same distance from that point.

Applications of Environment Map More history info on Reflectance map "Interface", courtesy of Lance Williams, 1985 Terminator 2, 1991 williams_robot4.mov

8/10/2015Lecture 2011 Sphere Mapping Basics OpenGL provides special support for a particular form of Normal mapping called sphere mapping. It maps the normals of the object to the corresponding normal of a sphere. It uses a texture map of a sphere viewed from infinity to establish the color for the normal.

8/10/2015Lecture 2012 Sphere Mapping Mapping the normal to a point on the sphere r1r1 r2r2 r3r3 n3n3 v3v3 n2n2 v2v2 n1n1 v1v1

8/10/2015Lecture 2013 Sphere Mapping Mapping the normal to a point on the sphere r1r1 r2r2 r3r3 n3n3 v3v3 n2n2 v2v2 n1n1 v1v1 Recall: r n v (-1,-1) (1,1)

OpenGL code Example // this gets inserted where the texture is created glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, (int) GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, (int) GL_SPHERE_MAP); glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); When doesn’t EM work well? Flat/planar surface In particular under orthographic projection Without a mirror ball, where to get environment map images?

8/10/2015Lecture 2015 What’s the Best Map? A sphere map is not the only representation choice for environment maps. There are alternatives, with more uniform sampling properties, but they require different normal-to-texture mapping functions.

Multi-Texturing

Why Multi-texturing Interpolating Textures – From day to night Implementing Bump maps – Create texture for diffuse coefficient, light vector, and normal maps: kd * max(L∙n, 0)

8/10/2015Lecture 2018 Multi-Texture: OpenGL Gluint texture0, texture1; //in Initi() Load in images, Initialize textures as before //in Display() do the following

Combining Textures glActiveTexture( GL_TEXTURE0 ); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D, texName0); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glActiveTexture( GL_TEXTURE1 ); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D, texName1); int choice = 0; if (choice == 0) //modulate the two textures { glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); } else if (choice == 1) //interpolate the two textures using the alpha of current primary color { glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE ); glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE1); glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); glTexEnvi( GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PRIMARY_COLOR); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); } else //disable the second texture { glActiveTexture(GL_TEXTURE1); glDisable(GL_TEXTURE_2D); } // continue on the right glActiveTexture( GL_TEXTURE0 ); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D, texName0); glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glActiveTexture( GL_TEXTURE1 ); glEnable( GL_TEXTURE_2D ); glBindTexture(GL_TEXTURE_2D, texName1); int choice = 0; if (choice == 0) //modulate the two textures { glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); } else if (choice == 1) //interpolate the two textures using the alpha of current primary color { glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE ); glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE ); glTexEnvi( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE1); glTexEnvi( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); glTexEnvi( GL_TEXTURE_ENV, GL_SRC2_RGB, GL_PRIMARY_COLOR); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); glTexEnvi( GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); } else //disable the second texture { glActiveTexture(GL_TEXTURE1); glDisable(GL_TEXTURE_2D); } // continue on the right glColor4f(0,0,0,0.2); glBegin(GL_QUADS); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); glMultiTexCoord2f(GL_TEXTURE1, 0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0); glMultiTexCoord2f(GL_TEXTURE1, 0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0); glMultiTexCoord2f(GL_TEXTURE1, 1.0, 1.0); glVertex3f(0.0, 1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE1, 1.0, 0.0); glVertex3f(0.0, -1.0, 0.0); glEnd(); glColor4f(0,0,0,0.2); glBegin(GL_QUADS); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 0.0); glMultiTexCoord2f(GL_TEXTURE1, 0.0, 0.0); glVertex3f(-2.0, -1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE0, 0.0, 1.0); glMultiTexCoord2f(GL_TEXTURE1, 0.0, 1.0); glVertex3f(-2.0, 1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 1.0); glMultiTexCoord2f(GL_TEXTURE1, 1.0, 1.0); glVertex3f(0.0, 1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE0, 1.0, 0.0); glMultiTexCoord2f(GL_TEXTURE1, 1.0, 0.0); glVertex3f(0.0, -1.0, 0.0); glEnd();

Different Combinations for different apps Interpolate for fade-in-fade-out between textures – Night and day Dot product followed by modulation for bump map – /simplebump.html /simplebump.html

Multi-Texture: OpenGL Each texture unit (GL_TEXTURE*) has its own state: – Texture image – Environment mode – Filtering parameters – Texture matrix stack – Automatic texture coordinate generation – … Create visual effect using your imagination.

GL Extensions Multi-texturing is not supported in visual studio. Need to download GL extension managers: – GLEE The "Easy" Gl Extension manager. – GLEW The Open GL Extension Wrangler. – More info: 1/GlExtensions.htm

Texture animation – Moving water texture to simulate flow – zoom, rotation, and shearing image on a surface – Fading in and fading out (Blending marble to skin) with multi-texturing