Texture Mapping CSCI 4229/5229 Computer Graphics Fall 2016

Similar documents
Lecture 22 Sections 8.8, 8.9, Wed, Oct 28, 2009

CS212. OpenGL Texture Mapping and Related

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

ก ก ก.

Texture Mapping. Mike Bailey.

CS335 Graphics and Multimedia. Slides adopted from OpenGL Tutorial

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

CS 432 Interactive Computer Graphics

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

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

GRAFIKA KOMPUTER. ~ M. Ali Fauzi

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation

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

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

Grafica Computazionale

Mipmaps. Lecture 23 Subsection Fri, Oct 30, Hampden-Sydney College. Mipmaps. Robb T. Koether. Discrete Sampling.

Lecture 5 3D graphics part 3

CT5510: Computer Graphics. Texture Mapping

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

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

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

Lecture 07: Buffers and Textures

三維繪圖程式設計 3D Graphics Programming Design 第七章基礎材質張貼技術嘉大資工系盧天麒

CMSC 425: Lecture 12 Texture Mapping Thursday, Mar 14, 2013

Computer Graphics. Bing-Yu Chen National Taiwan University

Mipmaps. Lecture 35. Robb T. Koether. Hampden-Sydney College. Wed, Nov 18, 2015

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

Steiner- Wallner- Podaras

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

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

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

Computer Graphics. Three-Dimensional Graphics VI. Guoying Zhao 1 / 73

Discussion 3. PPM loading Texture rendering in OpenGL

Most device that are used to produce images are. dots (pixels) to display the image. This includes CRT monitors, LCDs, laser and dot-matrix

Buffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

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

Texture Mapping and Sampling

CISC 3620 Lecture 7 Lighting and shading. Topics: Exam results Buffers Texture mapping intro Texture mapping basics WebGL texture mapping

Computational Strategies

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

Computer Graphics Texture Mapping

INF3320 Computer Graphics and Discrete Geometry

Magnification and Minification

11494 Interactive and GPU Computing Lab. 6-06/05/2015. Textures

CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Lecture 5. Scan Conversion Textures hw2

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

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

INF3320 Computer Graphics and Discrete Geometry

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

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

Assignment #5: Scalar Field Visualization 3D: Direct Volume Rendering

Computer Graphics Texture Mapping

Imaging and Raster Primitives

CS179: GPU Programming

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

Assignment #3: Scalar Field Visualization 3D: Cutting Plane, Wireframe Iso-surfacing, and Direct Volume Rendering

Lighting and Texturing

Texture mapping. Computer Graphics CSE 167 Lecture 9

9.Texture Mapping. Chapter 9. Chapter Objectives

Texture and other Mappings

Chapter 6 Texture Mapping

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

+ = Texturing: Glue n-dimensional images onto geometrical objects. Texturing. Texture magnification. Texture coordinates. Bilinear interpolation

Image I/O and OpenGL Textures

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

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

QUESTION 1 [10] 2 COS340-A October/November 2009

Shading/Texturing. Dr. Scott Schaefer

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

Texture Mapping. Texture (images) lecture 16. Texture mapping Aliasing (and anti-aliasing) Adding texture improves realism.

lecture 16 Texture mapping Aliasing (and anti-aliasing)

Computer Graphics

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

Department of Computer Sciences Graphics Spring 2013 (Lecture 19) Bump Maps

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

CS GPU and GPGPU Programming Lecture 12: GPU Texturing 1. Markus Hadwiger, KAUST

Stored Texture Shaders

Today. Texture mapping in OpenGL. Texture mapping. Basic shaders for texturing. Today. Computergrafik

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

CS GPU and GPGPU Programming Lecture 16+17: GPU Texturing 1+2. Markus Hadwiger, KAUST

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline:

Methodology for Lecture

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

Texturing Theory. Overview. All it takes is for the rendered image to look right. -Jim Blinn 11/10/2018

Announcements. Written Assignment 2 is out see the web page. Computer Graphics

Textures. Datorgrafik 2006

OpenCL / OpenGL Texture Interoperability: An Image Blurring Case Study

Graphics Processing Units (GPUs) V2.2 (January 2013) Jan Kautz, Anthony Steed, Tim Weyrich

LSU EE Homework 3 Solution Due: 12 October 2015

Rationale for Non-Programmable Additions to OpenGL 2.0

Introduction to OpenGL. Prof. Dr.-Ing. Lars Linsen

Texture Mapping 1/34

IntMu.Lab5. Download all the files available from

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

Computergraphics Exercise 15/ Shading & Texturing

Page 6 PROCESSOR PROCESSOR FRAGMENT FRAGMENT. texy[1] texx. texy[1] texx. texy[0] texy[0]

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

Workshop 3D capture, modelling and augmented reality Capture 3D, modélisation et réalité augmentée

Transcription:

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 the surfaces Can be stretched or repeated Simple in concept, but hardware intensive

Annunciation Leonardo da Vinci (1472)

OpenGL Texture Types Images are draped over polygon surfaces 1D, 2D and 3D textures (s,t,r,q) coordinates 2D uses (s,t), q is the homogeneous w 1D, 2D and 3D textures set separately 2D textures most commonly used

OpenGL Texture Calls glgentextures Returns unused texture name(s) glbindtexture Sets the active (current) texture glteximage* Copies image to texture memory gltexcoord* Sets texture coordinates for vertex gltexenv*, gltexparameter* Control application of textures

Creating a Texture glgentextures(1,&texname); Returns unique texture name glbindtexture(gl_texture_2d,texname); First use allocates memory and makes current glteximage2d(gl_texture_2d,0,3,dx,dy, 0,GL_RGB,GL_UNSIGNED_BYTE,image); Copies RGB image to texture memory (size dx xdy) Image size must be power of two before OpenGL 2

Setting the Texture Properties gltexparameteri(gl_texture_2d, GL_TEXTURE_MAG_FILTER,GL_LINEAR); How to maginfy texture gltexparameteri(gl_texture_2d, GL_TEXTURE_MIN_FILTER,GL_LINEAR); How to minify texture gltexenvi(gl_texture_2d, GL_TEXTURE_ENV_MODE,GL_MODULATE); How textures interact with underlying surface

Applying a Texture Map glbindtexture(gl_texture_2d,texname); glbegin(gl_polygon); for (i=0;i<n;i++) { gltexcoord2d(s[i],t[i]); glvertex3d(x[i],y[i],z[i]); } glend();

MIPmaps multum in parvo (much in little) Textures adapted to great distances Level 0=64x64, Level 1=32x32,..., Level 6=1x1 Can be generated manually or automatically glubuild2dmipmaps() glubuild2dmipmaplevels()

Multiple Textures glactivatetexture(gl_texturen); Call BEFORE glbindtexture() etc Specify multiple texture coordinates per vertex glmultitexcoord2f(gl_texture0,r0,s0); glmultitexcoord2f(gl_texture1,r1,s1); glmultitexcoord2f(gl_texture2,r2,s2); glvertex3d(x,y,z);

Automatic Texture Coordinates gltexgen*() Can generate textures automatically for polygons glutsolidteapot() Textures coordinates generated gluquadric objects gluquadrictexture(obj,bool) controls automatic texture coordinate generation

Creating a Texture glgentextures(n,texname[]); Returns n unique texture names glbindtexture(gl_texture_2d,texname); First use allocates memory and makes current Subsequent uses just makes it current All operations applies to current texture Current texture is applied to surfaces Current texture is modified by glteximage, etc

glteximage2d(gl_texture_2d,0,3,dx,dy, 0,GL_RGB,GL_UNSIGNED_BYTE,image); GL_TEXTURE_2D or GL_PROXY_TEXTURE_2D Level 0 (or higher for MIPmaps) Internal representation 3 (or one of many others) Size dx x dy [must be 2 n before OpenGL 2.0] Border 0 (none) or 1 (pixel width) Source image is RGB (or one of many others) Source data is unsigned char (or short, etc) Image data pointer (can be freed after call)

gltexparameter*(gl_texture_2d,par,val); GL_TEXTURE_MAG_FILTER (magnification) GL_LINEAR (interpolate) GL_NEAREST GL_TEXTURE_MIN_FILTER (minification) GL_LINEAR (interpolate) GL_NEAREST GL_NEAREST_MIPMAP_NEAREST GL_NEAREST_MIPMAP_LINEAR GL_LINEAR_MIPMAP_NEAREST GL_LINEAR_MIPMAP_LINEAR

gltexparameter*(gl_texture_2d,par,val); GL_TEXTURE_WRAP_S (horizontal) GL_TEXTURE_WRAP_T (vertical) GL_TEXTURE_WRAP_R (depth) GL_REPEAT (ignore integer part of s,t ) GL_MIRRORED_REPEAT (odds backward) GL_CLAMP - limit to (0,1) GL_CLAMP_TO_EDGE limit to ½ pixel in GL_CLAMP_TO_BORDER limit to ½ pixel out

gltexparameter*(gl_texture_2d,par,val); GL_TEXTURE_BORDER_COLOR Set border RGBA (4 component float vector) GL_TEXTURE_PRIORITY (0-1) and many more...

gltexenvi(gl_texture_2d,val,par) GL_TEXTURE_ENV_MODE GL_MODULATE (multiply) GL_REPLACE GL_DECAL (transparent combine) GL_BLEND GL_COMBINE GL_ADD (arithmetic) and many more...