Texture Coordinates CS418 Computer Graphics John C. Hart.

Slides:



Advertisements
Similar presentations
Lecture 8 Transparency, Mirroring
Advertisements

Virtual Realism TEXTURE MAPPING. The Quest for Visual Realism.
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.
Environment Mapping CSE 781 – Roger Crawfis
Projective Texture Mapping
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.
SE 313 – Computer Graphics Lecture 13: Lighting and Materials Practice Lecturer: Gazihan Alankuş 1.
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 6, 2014 TEXTURE MAPPING TEXTURES BUMP MAPPING ENVIRONMENT MAPPING PROCEDURAL TEXTURING.
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
Reflections from Bumpy Surfaces GPU Graphics. What are we trying to achieve?  Most surfaces are not flat like glass  Some of these surfaces still give.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
Advanced Texture and Lighting
IMGD 1001: Illumination by Mark Claypool
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Object-Order vs. Screen-Order Rendering April 24, 2003.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Lighting and Shading Wen-Chieh (Steve) Lin
(conventional Cartesian reference system)
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.
Environmental Maps Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
6.1 Vis_04 Data Visualization Lecture 6 - A Rough Guide to Rendering.
TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz
Environmental Mapping CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Coordinate Systems X Y Z (conventional Cartesian reference system) X Y Z.
Illumination Behaviour of light. Shading Overview Classical real-time shading: – vertices projected to screen – lighting calculation done at each vertex.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
CS 445 / 645 Introduction to Computer Graphics Lecture 18 Shading Shading.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Computer Graphics Computer Science: An Overview Tenth Edition.
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.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Environment Mapping. Examples Fall Motivation Silver candlestick No appropriate texture for it “ environment ” map Simulates the results of ray-tracing.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
Texture Mapping (cont.) Jian Huang, CS 594, updated in Fall’08.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
CS 445 / 645: Introductory Computer Graphics Light.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
October 9, 2002Serguei A. Mokhov, 1 COMP471 – Computer Graphics OpenGL: Texture Mapping.
Komputer Grafik 2 (AK045206) Shading 1/17 Realisme : Shading.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
Module 06 –environment mapping Module 06 – environment mapping Module 06 Advanced mapping techniques: Environment mapping.
Render methods. Contents Levels of rendering Wireframe Plain shadow Gouraud Phong Comparison Gouraud-Phong.
CDS 301 Fall, 2008 From Graphics to Visualization Chap. 2 Sep. 3, 2009 Jie Zhang Copyright ©
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
Reflectance Models CS 319 Advanced Topics in Computer Graphics John C. Hart.
So Far We have assumed that we know: The point The surface normal
CS-378: Game Technology Lecture #4: Texture and Other Maps
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Environment Mapping.
Simple Texture Mapping
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Texture Mapping Jung Lee.
Presentation transcript:

Texture Coordinates CS418 Computer Graphics John C. Hart

Texture Mapping u v (.2,.6) (.1,.6) (.1,.7)

TexGen GLfloat xplane[] = {1,0,0,0}; GLfloat yplane[] = {0,1,0,0}; glTexGenfv(GL_S,GL_OBJECT_PLANE, xplane); glTexGenfv(GL_T,GL_OBJECT_PLANE, yplane); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); y z x x y z y z x

Contouring Set texgen mode to object linear Define a plane Load a white texture with one black stripe Texture Mapping as a Fundamental Drawing Primitive Paul Haeberli and Mark Segal Graphica Obcura, June 1993

Bump Mapping dB/du = (B(u+h) – B(u))/h B u u v n’ = n – (dB/du) n  dS/dv + (dB/dv) n  dS/du u v n dS/du dS/dv n  dS/du -n  dS/dv B C n’n’ n dB du 1 dB/du

Environment Mapping Stores view from a point in all directions When rendering a fragment, compute reflection vector for eye (like the light reflection vector for specular reflection) Lookup prestored color and display that color as the reflection How can we store a precomputed view in all directions as a texture map? See the Story of Reflection Mapping:

Sphere Map Idea Photograph a reflective sphere (like a garden gazing ball) in whatever environment you like All possible normals you can see appear somewhere on the sphere Store image of reflective sphere as a texture map When rendering a point on a reflective object, find the point on the sphere with the same surface normal, and display the sphere’s color on the object Need to convert surface normal to texture coordinates

Sphere Map Geometry How to make a sphere map: For each point in disk: (x,y) s.t. x 2 + y 2  1 n = (x,y,(1-x 2 -y 2 ) ½ ) r = reflect((0,0,1),n) Determine color in r direction –Ray tracing –Images –Photograph 1 n n n r r r

OpenGL Sphere Map glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);

Photograph by David Kunzman

OpenGL Cube Map Sphere map creates distortion near the edges of the sphere Can use six different texture images to form a cube map (x,y,z)(x,y,z) u = y/x v = z/x x 1 (u,v)

OpenGL Cube Map Sphere map creates distortion near the edges of the sphere Can use six different texture images to form a cube map glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP); glEnable(GL_TEXTURE_GEN_S);..._T;..._R; glEnable(GL_TEXTURE_CUBE_MAP); glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X,...)

Texture Shading OpenGL lighting equation I = k a L a + k d L d (N  L) + k s L s (V  R) n Set texcoords of vertices to: s = N  L, t = V  R Create a texture by evaluating OpenGL lighting equation for each texel C(s,t) = k a L a + k d L d s + k s L s t n for all 0  s,t  1 Disable OpenGL lighting! Still just Gouraud color interpolation Must recompute texture coords when view changes s = N  L t = V  R

Phong Map The sphere map is an environment map stored as the reflection of a scene on sphere Not only stores scene, stores the reflection of the scene –Let the scene be a single point light source –Render a Phong specular highlight on a sphere –Use rendered sphere as an environment spheremap Texcoord interpolation samples highlight through face interior Texture is view/light dependent N x = 2s – 1 N y = 2t – 1 N z = (N x 2 + N y 2 ) ½ R = 2(N  L)N – L I = cos (V  R) n

Phong Map The sphere map is an environment map stored as the reflection of a scene on sphere Not only stores scene, stores the reflection of the scene –Let the scene be a single point light source –Render a Phong specular highlight on a sphere –Use rendered sphere as an environment spheremap Texcoord interpolation samples highlight through face interior

A Skin Texture Shader Skin appears softer than Lambertian reflectance because of subsurface scattering Seeliger lighting model I = (N  L) / (N  L + N  V ) Implement as a texture shader s = N  L t = N  V C = s/(s+t ) s t