University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures I Week 8, Mon.

Slides:



Advertisements
Similar presentations
Graphics Pipeline.
Advertisements

Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
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.
David Luebke5/11/2015 CS 551 / 645: Introductory Computer Graphics David Luebke
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures II Week 8, Wed.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Interpolation Clipping.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures I Week 9, Wed.
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
Texture Mapping CPSC /24/03 Abhijeet Ghosh.
Hofstra University1 Texture Motivation: to model realistic objects need surface detail: wood grain, stone roughness, scratches that affect shininess, grass,
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Visibility II Week 7,
OpenGL Texture Mapping
OpenGL Texture Mapping Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
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.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Visibility: Z Buffering Week 10, Mon 3 Nov 2003.
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.
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Hidden Surfaces III Week.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Computer Graphics Texture Mapping Eriq Muhammad Adams
2IV60 Computer Graphics set 10: Texture mapping Jack van Wijk TU/e.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Texture Mapping. Scope Buffers Buffers Various of graphics image Various of graphics image Texture mapping Texture mapping.
Texture Mapping Course: Computer Graphics Presented by Fan Chen
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
An Interactive Introduction to OpenGL Programming Ed Angel
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
CS 445 / 645 Introduction to Computer Graphics Lecture 19 Texture Maps Lecture 19 Texture Maps.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
3D Graphics for Game Programming Chapter IV Fragment Processing and Output Merging.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
2 COEN Computer Graphics I Evening’s Goals n Discuss displaying and reading image primitives n Describe texture mapping n Discuss OpenGL modes and.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Textures II Week 9, Fri.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner Rasterization.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Scan Conversion Week 5, Fri 3 Oct 2003 recap: shading scan conversion: lines.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Textures I Week 9, Fri.
CPSC 314 TEXTURE MAPPING UGRAD.CS.UBC.CA/~cs314 Glen Berseth (Based of Mikhail Bessmeltsev and Dinesh Pai)
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Viewing/Projections I.
OpenGL Texture Mapping
Models and Architectures
© University of Wisconsin, CS559 Fall 2004
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
3D Game Programming Texture Mapping
Textures II Week 10, Mon Mar 22
OpenGL Texture Mapping
3D Game Programming Texture Mapping
OpenGL Texture Mapping
Presentation transcript:

University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Textures I Week 8, Mon Feb 28

2 News face to face p2 grading this week you can check your time slot from scans posted to course page (student numbers blocked out) Mon 1-5, Tue 10-1, 3-5, Wed 1-5 midterm scaling announced

3 Midterm 1 Raw Scores range 26-98, avg 66

4 Midterm 1 Scaled Scores range 33-98, avg 69

5 News Homework 2 Q1-3 correction point A is (2,0,0) point B is (3,0,0) point C is (4,0,0)

6 Review: Warnock’s Algorithm start with root viewport and list of all objects recursion: clip objects to viewport if only 0 or 1 objects done else subdivide to new smaller viewports distribute objects to new viewpoints recurse

7 Review: Warnock’s Algorithm termination viewport is single pixel explicitly check for object occlusion single-pixel case common in high depth complexity scenes

8 Review: Z-Buffer Algorithm augment color framebuffer with Z-buffer or depth buffer which stores Z value at each pixel at frame beginning, initialize all pixel depths to  when rasterizing, interpolate depth (Z) across polygon check Z-buffer before storing pixel color in framebuffer and storing depth in Z-buffer don’t write pixel if its Z value is more distant than the Z value already stored there

9 Z-Buffer Demo

10 Review: Object vs. Image Space object space determine visibility on object or polygon level resolution independent, VCS / NDC coords early in pipeline requires depth sorting objects/polygons image space determine visibility at viewport or pixel level resolution dependent, screen coords late in pipeline

11 Texturing

12 Reading (whole week) FCG Chapter 10 Red Book Chapter Texture Mapping

13 Rendering Pipeline GeometryDatabaseGeometryDatabase Model/ViewTransform.Model/ViewTransform. LightingLightingPerspectiveTransform.PerspectiveTransform. ClippingClipping ScanConversionScanConversion DepthTestDepthTest TexturingTexturing BlendingBlending Frame-bufferFrame-buffer Geometry Processing Rasterization Fragment Processing

14 Texture Mapping real life objects nonuniform in terms of color & normal to generate realistic objects - reproduce coloring & normal variations = Texture can often replace complex geometric details

15 Texture Mapping introduced to increase realism lighting/shading models not enough hide geometric simplicity images convey illusion of geometry map a brick wall texture on a flat polygon create bumpy effect on surface associate 2D information with 3D surface point on surface corresponds to a point in texture “paint” image onto polygon

16 Color Texture Mapping define color (RGB) for each point on object surface two approaches surface texture map volumetric texture

17 Surface Texture define texture pattern over (u,v) domain (Image) image – 2D array of “texels” assign (u,v) coordinates to each point on object surface for free-form – use inverse of surface function for polygons (triangle) inside – use barycentric coordinates for vertices need mapping function u v

18 Texture Mapping + =

19 Mapping for Triangular Meshes mapping defined by vertices (3D) mapped to specified (u,v) locations in 2D each interior point mapped to 2D using barycentric coordinates

20 Texture Mapping texture map is an image, two-dimensional array of color values (texels) texels are specified by texture’s (u,v) space at each screen pixel, texel can be used to substitute a polygon’s surface property (color) we must map (u,v) space to polygon’s (s, t) space U V S T

21 Example Texture Map Applied to tilted polygon

22 Texture Mapping (u,v) to (s,t) mapping can be explicitly set at vertices by storing texture coordinates with each vertex OpenGL generation at vertices specified by programmer or artist glTexCoord2f(s,t) glVertexf(x,y,z)...

23 Texture Coordinates every polygon has object coordinates and texture coordinates object coordinates describe where polygon vertices are on the screen texture coordinates describe texel coordinates of each vertex texture coordinates are interpolated along vertex-vertex edges glTexCoord{1234}{sifd}(TYPE coords)

24 Example Texture Map glVertex3d (s, s, s) glTexCoord2d(1,1); glVertex3d (-s, -s, -s) glTexCoord2d(0,0);

25 Example Texture Map glVertex3d (s, s, s) glTexCoord2d(5, 5); glVertex3d (s, s, s) glTexCoord2d(1, 1);

26 Texture Lookup issue: what happens to fragments with s or t outside the interval [ 0…1 ]? multiple choices: take only fractional part of texture coordinates cyclic repetition of texture to tile whole surface glTexParameteri( …, GL_TEXTURE_WRAP_S, GL_REPEAT ) clamp every component to range [0…1] re-use color values from border of texture image glTexParameteri( …, GL_TEXTURE_WRAP_S, GL_CLAMP )

27 Texture Coordinate Transformation Motivation: Change scale, orientation of texture on an object Approach: texture matrix stack 4x4 matrix stack transforms specified (or generated) tex coords glMatrixMode( GL_TEXTURE ); glLoadIdentity(); …

28 Texture Coordinate Transformation Example: (0,0)(1,0) (0,1)(1,1) glScalef(4.0,4.0,?); (0,0)(4,0)(0,4)(4,4)

29 Texture Functions once have value from the texture map, can: directly use as surface color GL_REPLACE modulate surface color GL_MODULATE blend surface and texture colors GL_DECAL blend surface color with another GL_BLEND specific action depends on internal texture format only existing channels used specify with glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, mode)

30 Demo: Robbins Tutor

31 Texture Pipeline Compute object space location Use projector function to find (u, v) Use corresponder function to find texels Apply value transform function (e.g., scale, bias) Modify illumination equation value

32 Texture Pipeline v u eye Texel color (0.9,0.8,0.7) (x, y, z) Object position (-2.3, 7.1, 17.7) (u, v) Parameter space (0.32, 0.29) Texture Image space (81, 74)

33 Texture Mapping s t (s 0,t 0 ) (s 1,t 1 ) (s 2,t 2 ) (s, t) parameterization in OpenGL

34 Texture Mapping texture coordinates generation at vertices specified by programmer or artist glTexCoord2f(s,t) glVertexf(x,y,z) generate as a function of vertex coords glTexGeni(), glTexGenfv() s = a*x + b*y + c*z + d*h interpolated across triangle (like R,G,B,Z) …well not quite!

35 Texture Mapping texture coordinate interpolation perspective foreshortening problem also problematic for color interpolation, etc.

36 Attribute Interpolation Bilinear Interpolation Incorrect Perspective correct Correct

37 Texture Coordinate Interpolation perspective correct interpolation , ,  : barycentric coordinates of a point P in a triangle s0, s1, s2 : texture coordinates of vertices w0, w1,w2 : homogeneous coordinates of vertices

38 Volumetric Texture define texture pattern over 3D domain - 3D space containing the object texture function can be digitized or procedural for each point on object compute texture from point location in space common for natural material/irregular textures (stone, wood,etc…)

39 Volumetric Texture Principles 3D function      x,y,z) texture space – 3D space that holds the texture (discrete or continuous) rendering: for each rendered point P(x,y,z) compute   x,y,z) volumetric texture mapping function/space transformed with objects

40 Texture Effects: Simple Marble boring marble function boring_marble(point) x = point.x; return marble_color(sin(x)); // marble_color maps scalars to colors

41 Texture Effects: Bombing bombing randomly drop bombs of various shapes, sizes and orientation into texture space (store data in table) for point P search table and determine if inside shape if so, color by shape otherwise, color by objects color