# Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Save this PDF as:

Size: px
Start display at page:

Download "Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science"

## Transcription

1 Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1

2 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider basic strategies - Forward vs backward mapping - Point sampling vs area averaging 2

3 The Limits of Geometric Modeling Although graphics cards can render over 20 million polygons per second, that number is insufficient for many phenomena - Clouds - Grass - Terrain - Skin 3

4 Modeling an Orange Consider the problem of modeling an orange (the fruit) Start with an orange-colored sphere - Too simple Replace sphere with a more complex shape - Does not capture surface characteristics (small dimples) - Takes too many polygons to model all the dimples 4

5 Modeling an Orange (2) Take a picture of a real orange, scan it, and paste onto simple geometric model - This process is known as texture mapping Still might not be sufficient because resulting surface will be smooth - Need to change local shape - Bump mapping 5

6 Three Types of Mapping Texture Mapping - Uses images to fill inside of polygons Environment (reflection mapping) - Uses a picture of the environment for texture maps - Allows simulation of highly specular surfaces Bump mapping - Emulates altering normal vectors during the rendering process 6

7 Texture Mapping geometric model texture mapped 7

8 Environment Mapping 8

9 Bump Mapping 9

10 Where does mapping take place? Mapping techniques are implemented at the end of the rendering pipeline - Very efficient because few polygons make it past the clipper Vertices G eometry processing Rasteriz ation Fra gment processing Frame buffer Pixels Pixel processing 1 0

11 Is it simple? Although the idea is simple---map an image to a surface---there are 3 or 4 coordinate systems involved 2D image 3D surface 1 1

12 Coordinate Systems Parametric coordinates - May be used to model curves and surfaces Texture coordinates - Used to identify points in the image to be mapped Object or World Coordinates - Conceptually, where the mapping takes place Window Coordinates - Where the final image is really produced 1 2

13 Texture Mapping parametric coordinates texture coordinates world coordinates window coordinates 1 3

14 Mapping Functions Basic problem is how to find the maps Consider mapping from texture coordinates to a point a surface Appear to need three functions x = x(s,t) y = y(s,t) z = z(s,t) But we really want to go the other way t s (x,y,z) 1 4

15 Backward Mapping We really want to go backwards - Given a pixel, we want to know to which point on an object it corresponds - Given a point on an object, we want to know to which point in the texture it corresponds Need a map of the form s = s(x,y,z) t = t(x,y,z) Such functions are difficult to find in general 1 5

16 Two-part mapping One solution to the mapping problem is to first map the texture to a simple intermediate surface Example: map to cylinder 1 6

17 Cylindrical Mapping parametric cylinder x = r cos 2π u y = r sin 2πu z = v/h maps rectangle in u,v space to cylinder of radius r and height h in world coordinates s = u t = v maps from texture space 1 7

18 Spherical Map We can use a parametric sphere x = r cos 2πu y = r sin 2πu cos 2πv z = r sin 2πu sin 2πv in a similar manner to the cylinder but have to decide where to put the distortion Spheres are used in environmental maps 1 8

19 Box Mapping Easy to use with simple orthographic projection Also used in environment maps 1 9

20 Second Mapping Map from intermediate object to actual object - Normals from intermediate to actual - Normals from actual to intermediate - Vectors from center of intermediate actual intermediate 2 0

21 Aliasing Point sampling of the texture can lead to aliasing errors miss blue stripes point samples in u,v (or x,y,z) space point samples in texture space 2 1

22 Area Averaging A better but slower option is to use area averaging preimage pixel Note that preimage of pixel is curved 2 2

23 Go to ART Texture Mapping slides 2 3

24 OpenGL Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 2 4

25 Objectives Introduce the OpenGL texture functions and options 2 5

26 Basic Stragegy Three steps to applying a texture 1. specify the texture read or generate image assign to texture enable texturing 2. assign texture coordinates to vertices Proper mapping function is left to application 3. specify texture parameters wrapping, filtering 2 6

27 Texture Mapping y z x geometry display t image s 2 7

28 Texture Example The texture (below) is a 256 x 256 image that has been mapped to a rectangular polygon which is viewed in perspective 2 8

29 Texture Mapping and the OpenGL Pipeline Images and geometry flow through separate pipelines that join during fragment processing - complex textures do not affect geometric complexity vertices image geometry pipeline pixel pipeline fragment processor 2 9

30 Specifying a Texture Image Define a texture image from an array of texels (texture elements) in CPU memory Glubyte my_texels[512][512][3]; Define as any other pixel map - Scanned image - Generate by application code Enable texture mapping - glenable(gl_texture_2d) - OpenGL supports 1-4 dimensional texture maps 3 0

31 Define Image as a Texture glteximage2d( target, level, internalformat, w, h, border, format, type, texels ); target: type of texture, e.g. GL_TEXTURE_2D level: used for mipmapping (discussed later) internalformat: how texel is stored w, h: width and height of texels in pixels border: used for smoothing (discussed later) format and type: describe texels texels: pointer to texel array glteximage2d(gl_texture_2d, 0, GL_RGB, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, my_texels); 3 1

32 Mapping a Texture Application or shaders define texture coordinates Texture coordinates specified at each vertex t 0, 1 Texture Space a 1, 1 Object Space (s, t) = (0.2, 0.8) A c b 0, 0 1, 0 s (0.4, 0.2) B C (0.8, 0.4) 3 2

33 Typical Code Application sending texture coordinates offset = 0; GLuint vposition = glgetattriblocation( program, "vposition" ); glenablevertexattribarray( vposition ); glvertexattribpointer( vposition, 4, GL_FLOAT, GL_FALSE, 0,BUFFER_OFFSET(offset) ); offset += sizeof(points); GLuint vtexcoord = glgetattriblocation( program, "vtexcoord" ); glenablevertexattribarray( vtexcoord ); glvertexattribpointer( vtexcoord, 2,GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(offset) ); 3 3

34 Interpolation OpenGL uses interpolation to find proper texels from specified texture coordinates Can be distortions good selection of tex coordinates poor selection of tex coordinates texture stretched over trapezoid showing effects of bilinear interpolation 3 4

35 Texture Parameters OpenGL has a variety of parameters that determine how texture is applied - Wrapping parameters determine what happens if s and t are outside the (0,1) range - Filter modes allow us to use area averaging instead of point samples - Mipmapping allows us to use textures at multiple resolutions - Environment parameters determine how texture mapping interacts with shading 3 5

36 Wrapping Mode Clamping: if s,t > 1 use 1, if s,t <0 use 0 Wrapping: use s,t modulo 1 gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ) gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ) t texture s GL_REPEAT wrapping GL_CLAMP wrapping 3 6

37 Magnification and Minification More than one texel can cover a pixel (minification) or more than one pixel can cover a texel (magnification) Can use point sampling (nearest texel) or linear filtering ( 2 x 2 filter) to obtain texture values Texture Magnification Polygon Texture Minification Polygon 3 7

38 Filter Modes Modes determined by - gltexparameteri( target, type, mode ) gltexparameteri(gl_texture_2d, GL_TEXURE_MAG_FILTER, GL_NEAREST); gltexparameteri(gl_texture_2d, GL_TEXURE_MIN_FILTER, GL_LINEAR); Note that linear filtering requires a border of an extra texel for filtering at edges (border = 1) 3 8

39 Mipmapped Textures Mipmapping allows for prefiltered texture maps of decreasing resolutions Lessens interpolation errors for smaller textured objects Declare mipmap level during texture definition glteximage2d( GL_TEXTURE_*D, level, ) Have OpenGL make your mipmap glgeneratemipmap(target) Mipmaps invoked by setting sampling gltexparameteri(gl_texture_2d, GL_TEXURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 3 9

40 Example point sampling linear filtering mipmapped point sampling mipmapped linear filtering 4 0

41 Using Texture Objects 1. specify textures in texture objects 2. set texture filter 3. set texture wrap mode 4. bind texture object 5. enable texturing 6. supply texture coordinates for vertex - coordinates can also be generated 4 2

42 Other Texture Features Environment Maps - Start with image of environment through a wide angle lens Can be either a real scanned image or an image created in OpenGL - Use this texture to generate a spherical map - Alternative is to use a cube map Multitexturing - Apply a sequence of textures through cascaded texture units 4 3

43 Checkerboard Texture GLubyte image[64][64][3]; // Create a 64 x 64 checkerboard pattern for ( int i = 0; i < 64; i++ ) { for ( int j = 0; j < 64; j++ ) { GLubyte c = (((i & 0x8) == 0) ^ ((j & 0x8) == 0)) * 255; image[i][j][0] = c; image[i][j][1] = c; image[i][j][2] = c; 4 4

44 Adding Texture Coordinates void quad( int a, int b, int c, int d ) { quad_colors[index] = colors[a]; points[index] = vertices[a]; tex_coords[index] = vec2( 0.0, 0.0 ); index++; quad_colors[index] = colors[a]; points[index] = vertices[b]; tex_coords[index] = vec2( 0.0, 1.0 ); Index++; // other vertices } 4 5

45 Texture Object GLuint textures[1]; glgentextures( 1, textures ); glbindtexture( GL_TEXTURE_2D, textures[0] ); glteximage2d( GL_TEXTURE_2D, 0, GL_RGB, TextureSize, TextureSize, 0, GL_RGB, GL_UNSIGNED_BYTE, image ); gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); gltexparameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); glactivetexture( GL_TEXTURE0 ); 4 6

46 Linking with Shaders GLuint vtexcoord = glgetattriblocation( program, "vtexcoord" ); glenablevertexattribarray( vtexcoord ); glvertexattribpointer( vtexcoord, 2, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(offset) ); // Set the value of the fragment shader texture sampler variable // ("texture") to the the appropriate texture unit. In this case, // zero, for GL_TEXTURE0 which was previously set by calling // glactivetexture(). gluniform1i( glgetuniformlocation(program, "texture"), 0 ); 4 7

47 Vertex Shader Usually vertex shader will output texture coordinates to be rasterized Must do all other standard tasks too - Compute vertex position - Compute vertex color if needed in vec4 vposition; //vertex position in object coordinates in vec4 vcolor; //vertex color from application in vec2 vtexcoord; //texture coordinate from application out vec4 color; //output color to be interpolated out vec2 texcoord; //output tex coordinate to be interpolated 4 8

48 Applying Textures Textures are applied during fragment shading by a sampler Samplers return a texture color from a texture object in vec4 color; //color from rasterizer in vec2 texcoord; //texure coordinate from rasterizer uniform sampler2d texture; //texture object id from application void main() { gl_fragcolor = color * texture2d( texture, texcoord ); } 4 9

49 Using Textures Texture value may be used in ANY of the components of the shading formula For example - Diffuse color - Specular color - Ambient color - Shininess - Normals - Alpha Or as a decal, or mask or blended in 5 0

50 Suggestions for HW9 First add texture coordinates [u,v] to your vertices Just use the [u,v] pair used to compute the vertex on the Bezier patch Use a variant of the code in slides 45 -> 49 to define your texture object in your application and fragment shader Note that the texture coordinates get passed through to the fragment shader, where they are used to sample the 2D texture 5 1

51 Suggestions for HW9 To test if your texture coordinates are getting to the shaders properly, you could simply map the coordinates to the red & green channels of the fragment's color This is one way to visualize the texture coordinates values The color retrieved from the texture map should be used for the material s diffuse color in your Phong shading calculation in your fragment shader 5 2

52 Suggestions for HW9 For 3D procedural texturing I would suggest that your mapping from 3D Cartesian space to RGB color space be based on a location specified in world, NOT camera, coordinates. So you will need to pass the location of the vertices in world coordinates to the fragment shader 5 3

### CS452/552; EE465/505. Texture Mapping in WebGL

CS452/552; EE465/505 Texture Mapping in WebGL 2-26 15 Outline! Texture Mapping in WebGL Read: Angel, Chapter 7, 7.3-7.5 LearningWebGL lesson 5: http://learningwebgl.com/blog/?p=507 Lab3 due: Monday, 3/2

### Objectives. Texture Mapping and NURBS Week 7. The Limits of Geometric Modeling. Modeling an Orange. Three Types of Mapping. Modeling an Orange (2)

CS 480/680 INTERACTIVE COMPUTER GRAPHICS Texture Mapping and NURBS Week 7 David Breen Department of Computer Science Drexel University Objectives Introduce Mapping Methods Texture Mapping Environmental

### OpenGL Texture Mapping. Objectives Introduce the OpenGL texture functions and options

OpenGL Texture Mapping Objectives Introduce the OpenGL texture functions and options 1 Basic Strategy Three steps to applying a texture 1. 2. 3. specify the texture read or generate image assign to texture

### CS212. OpenGL Texture Mapping and Related

CS212 OpenGL Texture Mapping and Related Basic Strategy Three steps to applying a texture 1. specify the texture read or generate image assign to texture enable texturing 2. assign texture coordinates

### Surface Rendering. Surface Rendering

Surface Rendering Surface Rendering Introduce Mapping Methods - Texture Mapping - Environmental Mapping - Bump Mapping Go over strategies for - Forward vs backward mapping 2 1 The Limits of Geometric Modeling

### Graphics. Texture Mapping 고려대학교컴퓨터그래픽스연구실.

Graphics Texture Mapping 고려대학교컴퓨터그래픽스연구실 3D Rendering Pipeline 3D Primitives 3D Modeling Coordinates Model Transformation 3D World Coordinates Lighting 3D World Coordinates Viewing Transformation 3D Viewing

### CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics

CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook

### Texturas. Objectives. ! Introduce Mapping Methods. ! Consider two basic strategies. Computação Gráfica

Texturas Computação Gráfica Objectives! Introduce Mapping Methods! Texture Mapping! Environmental Mapping! Bump Mapping! Light Mapping! Consider two basic strategies! Manual coordinate specification! Two-stage

### Cap. 3 Textures. Mestrado em Engenharia Informática (6931) 1º ano, 1º semestre

Cap. 3 Textures Mestrado em Engenharia Informática (6931) 1º ano, 1º semestre Overview Objectives Notion of texture Motivation Texture mapping, texture patterns, and texels Mapping textures to polygons,

### Lecture 07: Buffers and Textures

Lecture 07: Buffers and Textures CSE 40166 Computer Graphics Peter Bui University of Notre Dame, IN, USA October 26, 2010 OpenGL Pipeline Today s Focus Pixel Buffers: read and write image data to and from

### CSE 167: Introduction to Computer Graphics Lecture #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #8: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due this Friday Midterm next Tuesday

### CT5510: Computer Graphics. Texture Mapping

CT5510: Computer Graphics Texture Mapping BOCHANG MOON Texture Mapping Simulate spatially varying surface properties Phong illumination model is coupled with a material (e.g., color) Add small polygons

### CS335 Graphics and Multimedia. Slides adopted from OpenGL Tutorial

CS335 Graphics and Multimedia Slides adopted from OpenGL Tutorial Texture Poly. Per Vertex Mapping CPU DL Texture Raster Frag FB Pixel Apply a 1D, 2D, or 3D image to geometric primitives Uses of Texturing

### Texture Mapping. Computer Graphics, 2015 Lecture 9. Johan Nysjö Centre for Image analysis Uppsala University

Texture Mapping Computer Graphics, 2015 Lecture 9 Johan Nysjö Centre for Image analysis Uppsala University What we have rendered so far: Looks OK, but how do we add more details (and colors)? Texture mapping

### GRAFIKA KOMPUTER. ~ M. Ali Fauzi

GRAFIKA KOMPUTER ~ M. Ali Fauzi Texture Mapping WHY TEXTURE? Imagine a Chess Floor Or a Brick Wall How to Draw? If you want to draw a chess floor, each tile must be drawn as a separate quad. A large flat

### Texture mapping. Computer Graphics CSE 167 Lecture 9

Texture mapping Computer Graphics CSE 167 Lecture 9 CSE 167: Computer Graphics Texture Mapping Overview Interpolation Wrapping Texture coordinates Anti aliasing Mipmaps Other mappings Including bump mapping

### CS452/552; EE465/505. Image Processing Frame Buffer Objects

CS452/552; EE465/505 Image Processing Frame Buffer Objects 3-12 15 Outline! Image Processing: Examples! Render to Texture Read: Angel, Chapter 7, 7.10-7.13 Lab3 new due date: Friday, Mar. 13 th Project#1

### SUMMARY. CS380: Introduction to Computer Graphics Texture Mapping Chapter 15. Min H. Kim KAIST School of Computing 18/05/03.

CS380: Introduction to Computer Graphics Texture Mapping Chapter 15 Min H. Kim KAIST School of Computing Materials SUMMARY 2 1 Light blob from PVC plastic Recall: Given any vector w (not necessarily of

### -=Catmull's Texturing=1974. Part I of Texturing

-=Catmull's Texturing=1974 but with shaders Part I of Texturing Anton Gerdelan Textures Edwin Catmull's PhD thesis Computer display of curved surfaces, 1974 U.Utah Also invented the z-buffer / depth buffer

### CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

CSC 307 1.0 Graphics Programming Department of Statistics and Computer Science Graphics Programming Texture Mapping 2 Texture Poly. Per Vertex Mapping CPU DL Pixel Texture Raster Frag FB Apply a 1D, 2D,

### Computergraphics Exercise 15/ Shading & Texturing

Computergraphics Exercise 15/16 3. Shading & Texturing Jakob Wagner for internal use only Shaders Vertex Specification define vertex format & data in model space Vertex Processing transform to clip space

### CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture 11: Textures 2 Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011 Announcements Homework assignment #5 due Friday, Nov 4,

### CSE 167: Introduction to Computer Graphics Lecture #9: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CSE 167: Introduction to Computer Graphics Lecture #9: Textures Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013 Announcements Added Tuesday office hours for Krishna: 11am-12

### Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

Texture Mapping Textures The realism of an image is greatly enhanced by adding surface textures to the various faces of a mesh object. In part a) images have been pasted onto each face of a box. Part b)

### Texture and other Mappings

Texture and other Mappings Texture Mapping Bump Mapping Displacement Mapping Environment Mapping Example: Checkerboard Particularly severe problems in regular textures 1 The Beginnings of a Solution: Mipmapping

### Texture Mapping. Texture Mapping. Map textures to surfaces. Trompe L Oeil ( Deceive the Eye ) The texture. Texture map

CSCI 42 Computer Graphic Lecture 2 Texture Mapping A way of adding urface detail Texture Mapping Jernej Barbic Univerity of Southern California Texture Mapping + Shading Filtering and Mipmap Non-color

### Computer Graphics. Bing-Yu Chen National Taiwan University

Computer Graphics Bing-Yu Chen National Taiwan University Introduction to OpenGL General OpenGL Introduction An Example OpenGL Program Drawing with OpenGL Transformations Animation and Depth Buffering

### Steiner- Wallner- Podaras

Texturing 2 3 Some words on textures Texturing = mapping 2D image to a model (*You will hear more on other texturing- methods in the course.) Not a trivial task! 4 Texturing how it works 5 UV coordinates

### Texturing. Slides done by Tomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

Texturing Slides done by Tomas Akenine-Möller and Ulf Assarsson Department of Computer Engineering Chalmers University of Technology 1 Texturing: Glue n-dimensional images onto geometrical objects l Purpose:

### General Purpose computation on GPUs. Liangjun Zhang 2/23/2005

General Purpose computation on GPUs Liangjun Zhang 2/23/2005 Outline Interpretation of GPGPU GPU Programmable interfaces GPU programming sample: Hello, GPGPU More complex programming GPU essentials, opportunity

Stored Texture Shaders 157 Preparing for Texture Access These steps are the same when using a shader as when using fixed functionality Make a specific texture unit active by calling glactivetexture Create

### Computer Graphics (CS 543) Lecture 8c: Environment Mapping (Reflections and Refractions)

Computer Graphics (CS 543) Lecture 8c: Environment Mapping (Reflections and Refractions) Prof Emmanuel Agu (Adapted from slides by Ed Angel) Computer Science Dept. Worcester Polytechnic Institute (WPI)

### Overview. Goals. MipMapping. P5 MipMap Texturing. What are MipMaps. MipMapping in OpenGL. Generating MipMaps Filtering.

Overview What are MipMaps MipMapping in OpenGL P5 MipMap Texturing Generating MipMaps Filtering Alexandra Junghans junghana@student.ethz.ch Advanced Filters You can explain why it is a good idea to use

### Preparing for Texture Access. Stored Texture Shaders. Accessing Texture Maps. Vertex Shader Texture Access

Stored Texture Shaders Preparing for Texture Access These steps are the same when using a shader as when using fixed functionality Make a specific texture unit active by calling glactivetexture Create

### OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction

TEXTURE MAPPING 1 OUTLINE Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction 2 BASIC STRAGEGY Three steps to applying a texture 1. specify the texture

### Computer Graphics Texture Mapping

Computer Graphics 2012 13. Texture Mapping Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2012-10-31 有关实验 - 备用 ftp 地址 - 10.214.0.111 - 帐号 :cg2012 - 密码 :2012 - 请按照规定上传到指定目录, 便于管理和检查 - 今日实验签到

### Texture Mapping 1/34

Texture Mapping 1/34 Texture Mapping Offsets the modeling assumption that the BRDF doesn t change in u and v coordinates along the object s surface Store a reflectance as an image called a texture Map

### Imaging and Raster Primitives

Realtime 3D Computer Graphics & Virtual Reality Bitmaps and Textures Imaging and Raster Primitives Vicki Shreiner Imaging and Raster Primitives Describe OpenGL s raster primitives: bitmaps and image rectangles

### Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

Copyright Khronos Group 2012 Page 1 Teaching GL Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012 Copyright Khronos Group 2012 Page 2 Agenda Overview of OpenGL family of APIs Comparison

### Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016

Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016 What are texture maps? Bitmap images used to assign fine texture to displayed surfaces Used to make surfaces appear more realistic Must move with

### Texture Mapping and Special Effects

Texture Mapping and Special Effects February 23 rd 26 th 2007 MAE 410-574, Virtual Reality Applications and Research Instructor: Govindarajan Srimathveeravalli HW#5 Due March 2 nd Implement the complete

### Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Building Models CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce simple data structures for building polygonal models - Vertex lists - Edge

### Texture Mapping 1/34

Texture Mapping 1/34 Texture Mapping Offsets the modeling assumption that the BRDF doesn t change in u and v coordinates along the object s surface Store a reflectance as an image called a texture Map

### Tutorial 3: Texture Mapping

Tutorial 3: Texture Mapping Summary In this tutorial, you are going to learn about texture mapping, by performing some texture mapping operations on the triangle you ve been using in the previous tutorials.

### Textures. Texture coordinates. Introduce one more component to geometry

Texturing & Blending Prof. Aaron Lanterman (Based on slides by Prof. Hsien-Hsin Sean Lee) School of Electrical and Computer Engineering Georgia Institute of Technology Textures Rendering tiny triangles

### Magnification and Minification

Magnification and Minification Lecture 30 Robb T. Koether Hampden-Sydney College Fri, Nov 6, 2015 Robb T. Koether (Hampden-Sydney College) Magnification and Minification Fri, Nov 6, 2015 1 / 17 Outline

### C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

### CS 450: COMPUTER GRAPHICS TEXTURE MAPPING SPRING 2015 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS TEXTURE MAPPING SPRING 2015 DR. MICHAEL J. REALE INTRODUCTION Texturing = process that takes a surface and modifies its appearance at each location using some image, function,

### Shaders. Slide credit to Prof. Zwicker

Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

### OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders

OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders Prateek Shrivastava CS12S008 shrvstv@cse.iitm.ac.in 1 GLSL Data types Scalar types: float, int, bool Vector

### Tutorial 12: Real-Time Lighting B

Tutorial 12: Real-Time Lighting B Summary The last tutorial taught you the basics of real time lighting, including using the normal of a surface to calculate the diffusion and specularity. Surfaces are

### TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

TEXTURE MAPPING DVA338 Computer Graphics Thomas Larsson, Afshin Ameri OVERVIEW Motivation Texture Mapping Coordinate Mapping (2D, 3D) Perspective Correct Interpolation Texture Filtering Mip-mapping Anisotropic

### To Do. Review of Last Demo. Methodology for Lecture. Geometry Basic Setup. Outline. Foundations of Computer Graphics (Fall 2012)

Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 8: OpenGL 2 http://inst.eecs.berkeley.edu/~cs184 To Do Continue working on HW 2. Can be difficult Class lectures, programs primary source Can

### CS 428: Fall Introduction to. Texture mapping and filtering. Andrew Nealen, Rutgers, /18/2010 1

CS 428: Fall 2010 Introduction to Computer Graphics Texture mapping and filtering 10/18/2010 1 Topic overview Image formation and OpenGL Transformations and viewing Polygons and polygon meshes 3D model/mesh

### OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

OpenGL Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University Background Software interface to graphics hardware 250+ commands Objects (models) are built from geometric primitives

### Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Shading Models There are two main types of rendering that we cover, polygon rendering ray tracing Polygon rendering is used to apply illumination models to polygons, whereas ray tracing applies to arbitrary

### Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016

Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016 In brief Starting with a simple model In brief Caveat : Issues with sampling & aliasing associate texture coordinates with primitives

### https://ilearn.marist.edu/xsl-portal/tool/d4e4fd3a-a3...

Assessment Preview - This is an example student view of this assessment done Exam 2 Part 1 of 5 - Modern Graphics Pipeline Question 1 of 27 Match each stage in the graphics pipeline with a description

### Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Normal Mapping Store normals in texture

### The Rasterization Pipeline

Lecture 5: The Rasterization Pipeline Computer Graphics and Imaging UC Berkeley CS184/284A, Spring 2016 What We ve Covered So Far z x y z x y (0, 0) (w, h) Position objects and the camera in the world

### Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Comp 410/510 Computer Graphics Spring 2017 Programming with OpenGL Part 2: First Program Objectives Refine the first program Introduce a standard program structure - Initialization Program Structure Most

### The Rasterization Pipeline

Lecture 5: The Rasterization Pipeline Computer Graphics and Imaging UC Berkeley What We ve Covered So Far z x y z x y (0, 0) (w, h) Position objects and the camera in the world Compute position of objects

### Texture Mapping Part 1

Texture Mapping Part 1 The Quest for Visual Realism Why Texture Map? How to do it How to do it right Spilling the beans Assignment #3 Lecture 17 Comp 236 Spring 2005 3/21/2005 Lecture 17 2 Decal Textures

### GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Programmable Shaders //per vertex inputs from main attribute aposition; attribute anormal; //outputs to frag. program varying

### CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Introduction to Computer Graphics Lecture #8: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012 Announcements Homework project #4 due Friday, November 2 nd Introduction:

### CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due Friday 4/22 at 2pm Midterm #1 on

### Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics

Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS

### Module 13C: Using The 3D Graphics APIs OpenGL ES

Module 13C: Using The 3D Graphics APIs OpenGL ES BREW TM Developer Training Module Objectives See the steps involved in 3D rendering View the 3D graphics capabilities 2 1 3D Overview The 3D graphics library

### Computer Graphics. Texture Filtering & Sampling Theory. Hendrik Lensch. Computer Graphics WS07/08 Texturing

Computer Graphics Texture Filtering & Sampling Theory Hendrik Lensch Overview Last time Texture Parameterization Procedural Shading Today Texturing Filtering 2D Texture Mapping Forward mapping Object surface

### CS 431/636 Advanced Rendering Techniques

CS 431/636 Advanced Rendering Techniques Dr. David Breen Matheson 308 Thursday 6PM 8:50PM Presentation 7 5/23/06 Questions from Last Time? Hall Shading Model Shadows Reflections Refractions Slide Credits

### lecture 16 Texture mapping Aliasing (and anti-aliasing)

lecture 16 Texture mapping Aliasing (and anti-aliasing) Texture (images) Texture Mapping Q: Why do we need texture mapping? A: Because objects look fake and boring without it. Adding texture improves realism.

### Evolution of GPUs Chris Seitz

Evolution of GPUs Chris Seitz Overview Concepts: Real-time rendering Hardware graphics pipeline Evolution of the PC hardware graphics pipeline: 1995-1998: Texture mapping and z-buffer 1998: Multitexturing

### GLSL Applications: 2 of 2

Administrivia GLSL Applications: 2 of 2 Patrick Cozzi University of Pennsylvania CIS 565 - Spring 2011 Assignment 2 due today 11:59pm on Blackboard Assignment 3 handed out today Due Wednesday, 02/09 at

Objectives Shading in OpenGL Introduce the OpenGL shading methods - per vertex shading vs per fragment shading - Where to carry out Discuss polygonal shading - Flat - Smooth - Gouraud CITS3003 Graphics

### Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics

Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS

### + = To Do. Texture Mapping. Adding Visual Detail. Parameterization. Option: Varieties of projections. Computer Graphics. geometry

Computer Graphics CSE 167 [Win 17], Lecture 18: Texture Mapping Ravi Ramamoorthi To Do Prepare for final push on HW 4 We may have a brief written assignment http://viscomp.ucsd.edu/classes/cse167/wi17

### GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences

### AGDC Per-Pixel Shading. Sim Dietrich

AGDC Per-Pixel Shading Sim Dietrich Goal Of This Talk The new features of Dx8 and the next generation of HW make huge strides in the area of Per-Pixel Shading Most developers have yet to adopt Per-Pixel

### Einführung in Visual Computing

Einführung in Visual Computing 186.822 Textures Werner Purgathofer Surface-Rendering Methods polygon rendering methods ray tracing global illumination environment mapping texture mapping bump mapping Werner

### OpenGL Performances and Flexibility. Visual Computing Laboratory ISTI CNR, Italy

OpenGL Performances and Flexibility Visual Computing Laboratory ISTI CNR, Italy The Abstract Graphics Pipeline Application 1. The application specifies vertices & connectivity. Vertex Processing 2. The

Lessons Learned from HW Shading CS Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Only have an idle() function if something is animated Set idle function to NULL, when

### Spring 2009 Prof. Hyesoon Kim

Spring 2009 Prof. Hyesoon Kim Application Geometry Rasterizer CPU Each stage cane be also pipelined The slowest of the pipeline stage determines the rendering speed. Frames per second (fps) Executes on

### 3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts

### OPENGL RENDERING PIPELINE

CPSC 314 03 SHADERS, OPENGL, & JS UGRAD.CS.UBC.CA/~CS314 Textbook: Appendix A* (helpful, but different version of OpenGL) Alla Sheffer Sep 2016 OPENGL RENDERING PIPELINE 1 OPENGL RENDERING PIPELINE Javascript

### CS GAME PROGRAMMING Question bank

CS6006 - GAME PROGRAMMING Question bank Part A Unit I 1. List the different types of coordinate systems. 2. What is ray tracing? Mention some applications of ray tracing. 3. Discuss the stages involved

### Shadows in Computer Graphics. by Björn Kühl im/ve University of Hamburg, Germany

Shadows in Computer Graphics by Björn Kühl im/ve University of Hamburg, Germany Importance of Shadows Shadows provide cues to the position of objects casting and receiving shadows to the position of the

### OpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak

OpenGL SUPERBIBLE Fifth Edition Comprehensive Tutorial and Reference Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San

### Chapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or

Chapter 9 Texture Mapping An Overview and an Example Steps in Texture Mapping A Sample Program Specifying the Texture Texture Proxy Replacing All or Part of a Texture Image One Dimensional Textures Using

### COMP environment mapping Mar. 12, r = 2n(n v) v

Rendering mirror surfaces The next texture mapping method assumes we have a mirror surface, or at least a reflectance function that contains a mirror component. Examples might be a car window or hood,

### Soft Particles. Tristan Lorach

Soft Particles Tristan Lorach tlorach@nvidia.com January 2007 Document Change History Version Date Responsible Reason for Change 1 01/17/07 Tristan Lorach Initial release January 2007 ii Abstract Before:

### PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.

PROFESSIONAL WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB Andreas Anyuru WILEY John Wiley & Sons, Ltd. INTRODUCTION xxl CHAPTER 1: INTRODUCING WEBGL 1 The Basics of WebGL 1 So Why Is WebGL So Great?

### CS193P - Lecture 19. iphone Application Development. OpenGL ES

CS193P - Lecture 19 iphone Application Development OpenGL ES 1 Announcements Final projects due in 7 days Tuesday, March 16th 11:59 pm Submit: Code Power-point/Keynote slides ReadMe file Final project

### Methodology for Lecture. Importance of Lighting. Outline. Shading Models. Brief primer on Color. Foundations of Computer Graphics (Spring 2010)

Foundations of Computer Graphics (Spring 2010) CS 184, Lecture 11: OpenGL 3 http://inst.eecs.berkeley.edu/~cs184 Methodology for Lecture Lecture deals with lighting (teapot shaded as in HW1) Some Nate