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

Similar documents
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 #8: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

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

Texture mapping. Computer Graphics CSE 167 Lecture 9

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

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

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

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

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

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

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

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

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

Texture Mapping and Sampling

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

Texture Mapping 1/34

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

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

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

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

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

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

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

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

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Texture Mapping 1/34

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Problem Max. Points Total 80

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

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

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

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

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

Lecture 07: Buffers and Textures

Computer Graphics 7 - Texture mapping, bump mapping and antialiasing

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

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

CPSC / Texture Mapping

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

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

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

Sampling, Aliasing, & Mipmaps

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

lecture 16 Texture mapping Aliasing (and anti-aliasing)

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

3D Rasterization II COS 426

Texture Mapping II. Light maps Environment Maps Projective Textures Bump Maps Displacement Maps Solid Textures Mipmaps Shadows 1. 7.

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

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

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

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 #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

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

Sampling, Aliasing, & Mipmaps

Texture Mapping. Mike Bailey.

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

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

Textures. Texture Mapping. Bitmap Textures. Basic Texture Techniques

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

Texture and other Mappings

Textures and normals in ray tracing

CS212. OpenGL Texture Mapping and Related

+ = To Do. Adding Visual Detail. Texture Mapping. Parameterization. Option: Varieties of projections. Foundations of Computer Graphics (Fall 2012)

Computer Graphics Texture Mapping

Lecture 19: OpenGL Texture Mapping. CITS3003 Graphics & Animation

Topics and things to know about them:

Sampling, Aliasing, & Mipmaps

CS335 Graphics and Multimedia. Slides adopted from OpenGL Tutorial

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

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

Perspective Projection and Texture Mapping

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

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

CS 432 Interactive Computer Graphics

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

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

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

CS 5600 Spring

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

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

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

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

Lecture 5 3D graphics part 3

Computational Strategies

Exercise Max. Points Total 90

INF3320 Computer Graphics and Discrete Geometry

CSE 167: Introduction to Computer Graphics Lecture #4: Coordinate Systems

CIS 581 Interactive Computer Graphics (slides based on Dr. Han-Wei Shen s slides) Requirements. Reference Books. Textbook

CS 431/636 Advanced Rendering Techniques

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

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

Reading. 12. Texture Mapping. Texture mapping. Non-parametric texture mapping. Required. w Watt, intro to Chapter 8 and intros to 8.1, 8.4, 8.6, 8.8.

Computer Graphics. Bing-Yu Chen National Taiwan University

CIS 581 Interactive Computer Graphics

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CS 354R: Computer Game Technology

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

Transcription:

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, grading in lab 260 starts as usual at 1:30pm StarCAVE demonstration Nov 15 after class Instructor s office hour moves from Nov 15 to Nov 17 (same time) Next lecture: Midterm review Midterm exams distributed 2

Lecture Overview Texturing Wrapping Texture coordinates Anti-aliasing 3

Wrap Modes Texture image extends from [0,0] to [1,1] in texture space What if (s,t) texture coordinates are beyond that range? Wrap modes 4

Repeat Repeat the texture Creates discontinuities at edges unless texture designed to line up (1,1) t (0,0) s Seamless brick wall texture (by Christopher Revoir) 5 Texture Space

Clamp Use edge value everywhere outside data range [0..1] Or, ignore the texture outside [0..1] (1,1) t (0,0) s 6 Texture Space

Wrap Mode Specification in OpenGL Default: gltexparameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); gltexparameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); Options for wrap mode: GL_CLAMP (requires border to be set) GL_CLAMP_TO_EDGE (repeats last pixel in texture), GL_REPEAT 7

Lecture Overview Texturing Wrapping Texture coordinates Anti-aliasing 8

Texture Coordinates What if texture extends across multiple polygons? Surface parameterization Mapping between 3D positions on surface and 2D texture coordinates In practice, defined by texture coordinates of triangle vertices Options for mapping: Parametric Orthographic Projective Spherical Cylindrical Skin 9

Parametric Mapping Surface given by parametric functions Very common in CAD Clamp (u,v) parameters to [0..1] and use as texture coordinates (s,t) 10

Orthographic Mapping Use linear transformation of object s xyz coordinates For example: = w z y x t s 0 0 1 0 0 0 0 1 11

Projective Mapping Use perspective projection of xyz coordinates OpenGL provides GL_TEXTURE matrix to apply perspective projection on texture coordinates Can be used for fake lighting effects 12

Spherical Mapping Use spherical coordinates for sphere Place object in sphere shrink-wrap sphere to object 13

Cylindrical Mapping Similar as spherical mapping, but using cylinder Useful for faces 14

Skin Mapping Complex technique to unfold surface onto plane Preserve area and angle Sophisticated mathematics 15

Lecture Overview Texturing Wrapping Texture coordinates Anti-aliasing 16

Example for Aliasing What could cause this effect? 17

Aliasing Sufficiently sampled, no aliasing Insufficiently sampled, aliasing Image: Robert L. Cook High frequencies in the input data can appear as lower frequencies in the sampled signal 18

Antialiasing: Intuition Pixel may cover large area on triangle in camera space Corresponds to many texels in texture space Need to compute average Image plane Camera space Texture space Texels Pixel area 19

Antialiasing: Mathematics Pixels are sample points, not little squares! See article by Dr. Alvy Ray Smith, Microsoft: http://alvyray.com/memos/cg/microsoft/6_pixel.pdf Antialiasing is achieved through low-pass filtering For more information: Master s Thesis: Fundamentals of Texture Mapping and Image Warping, Paul Heckbert, UC Berkeley: http://www.cs.cmu.edu/~ph/texfund/texfund.pdf 20

Antialiasing Using Mip-Maps Averaging over texels is expensive Many texels as objects get smaller Large memory access and compuation cost Precompute filtered (averaged) textures Mip-maps Practical solution to aliasing problem Fast and simple Available in OpenGL, implemented in GPUs Reasonable quality 21

Mipmaps MIP stands for multum in parvo = much in little (Williams 1983) Before rendering Pre-compute and store down scaled versions of textures Reduce resolution by factors of two successively Use high quality filtering (averaging) scheme Increases memory cost by 1/3 1/3 = ¼+1/16+1/64+ Width and height of texture should be powers of two (nonpower of two supported since OpenGL 2.0) 22

Mipmaps Example: resolutions 512x512, 256x256, 128x128, 64x64, 32x32 pixels Level 1 23 Level 0 2 3 4 multum in parvo

Mipmaps One texel in level 4 is the average of 4 4 =256 texels in level 0 Level 1 24 Level 0 2 3 4 multum in parvo

Mipmaps Level 0 Level 1 Level 2 25 Level 3 Level 4

Rendering With Mipmaps Mipmapping Interpolate texture coordinates of each pixel as without mipmapping Compute approximate size of pixel in texture space Look up color in nearest mipmap E.g., if pixel corresponds to 10x10 texels use mipmap level 3 Use nearest neighbor or bilinear interpolation as before 26

Mipmapping Image plane Camera space Texture space Texels Pixel area 27 Mip-map level 0 Mip-map level 1 Mip-map level 2 Mip-map level 3

Nearest Mipmap, Nearest Neighbor Visible transition between mipmap levels 28

Nearest Mipmap, Bilinear Visible transition between mipmap levels 29

Trilinear Mipmapping Use two nearest mipmap levels E.g., if pixel corresponds to 10x10 texels, use mipmap levels 3 (8x8) and 4 (16x16) Perform bilinear interpolation in both mip-maps Linearly interpolate between the results Requires access to 8 texels for each pixel Standard method, supported by hardware with no performance penalty 30

Nearest Mipmap, Bilinear Visible transition between mipmap levels 31

Trilinear Mipmapping Smooth transition between mipmap levels 32

Next Lecture Midterm review Curves 33