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

Similar documents
Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

CPSC / Texture Mapping

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

Texture mapping. Computer Graphics CSE 167 Lecture 9

CS 130 Final. Fall 2015

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

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

Computer Graphics. - Texturing Methods -

3D Rasterization II COS 426

Sampling, Aliasing, & Mipmaps

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Point-Based Rendering

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

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

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

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

Texture Mapping 1/34

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

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 GPU and GPGPU Programming Lecture 16+17: GPU Texturing 1+2. Markus Hadwiger, KAUST

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

Sampling, Aliasing, & Mipmaps

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

Texture Mapping. Brian Curless CSE 457 Spring 2016

CHAPTER 1 Graphics Systems and Models 3

CT5510: Computer Graphics. Texture Mapping

Texture Mapping 1/34

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

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

Sampling, Aliasing, & Mipmaps

Review of Tuesday. ECS 175 Chapter 3: Object Representation

Einführung in Visual Computing

Surface Rendering. Surface Rendering

INF3320 Computer Graphics and Discrete Geometry

Textures. Texture coordinates. Introduce one more component to geometry

Chapter IV Fragment Processing and Output Merging. 3D Graphics for Game Programming

Textures and normals in ray tracing

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. - Texturing - Philipp Slusallek

CS 5600 Spring

Texture-Mapping Tricks. How Bad Does it Look? We've Seen this Sort of Thing Before. Sampling Texture Maps

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

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

CS 354R: Computer Game Technology

More Texture Mapping. Texture Mapping 1/46

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

AMCS / CS 247 Scientific Visualization Lecture 10: (GPU) Texture Mapping. Markus Hadwiger, KAUST

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

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

Graphics for VEs. Ruth Aylett

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

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

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

Texture Mapping and Sampling

Animation & Rendering

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

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

Perspective Projection and Texture Mapping

Graphics for VEs. Ruth Aylett

Texture and other Mappings

x ~ Hemispheric Lighting

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

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

Outline. Sampling and Reconstruction. Sampling and Reconstruction. Foundations of Computer Graphics (Fall 2012)

Texture Mapping. Brian Curless CSE 457 Spring 2015

Adaptive Point Cloud Rendering

Computer Graphics 7 - Texture mapping, bump mapping and antialiasing

Complex Features on a Surface. CITS4241 Visualisation Lectures 22 & 23. Texture mapping techniques. Texture mapping techniques

Mattan Erez. The University of Texas at Austin

Texture Mapping. Reading. Implementing texture mapping. Texture mapping. Daniel Leventhal Adapted from Brian Curless CSE 457 Autumn 2011.

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

v. T u. Textures. Perlin, SIGGRAPH85. Werner Purgathofer

Spring 2012 Final. CS184 - Foundations of Computer Graphics. University of California at Berkeley

Basics. Sampling and Reconstruction. Sampling and Reconstruction. Outline. (Spatial) Aliasing. Advanced Computer Graphics (Fall 2010)

9. Three Dimensional Object Representations

CS 4620 Midterm, March 21, 2017

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

CS 563 Advanced Topics in Computer Graphics Lecture 2: Bare-Bones Raytracer. by Emmanuel Agu

CS 428: Fall Introduction to. Realism (overview) Andrew Nealen, Rutgers, /11/2009 1

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Lecture 6: Texture. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Computer Graphics - Week 7

Pipeline Operations. CS 4620 Lecture 10

Reading. Texture Mapping. Non-parametric texture mapping. Texture mapping. Required. Angel, 8.6, 8.7, 8.9, 8.10,

Rasterization Overview

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

Textures Tutorial. Using Cobalt, Xenon, Argon. Copyright Vellum Investment Partners dba Ashlar-Vellum. All rights reserved.

Topic 12: Texture Mapping. Motivation Sources of texture Texture coordinates Bump mapping, mip-mapping & env mapping

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

CS 431/636 Advanced Rendering Techniques

Reading. Texture Mapping. Non-parametric texture mapping. Texture mapping. Required. Angel, 8.6, 8.7, 8.9, Recommended

Topic 11: Texture Mapping 11/13/2017. Texture sources: Solid textures. Texture sources: Synthesized

Render-To-Texture Caching. D. Sim Dietrich Jr.

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

Overview. Hierarchy. Level of detail hierarchy Texture maps Procedural shading and texturing Texture synthesis and noise.

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

Transcription:

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 representations Piecewise linear shape approximations Illumination and polygon shading Modeling and animation Rendering 10/18/2010 2

Topic overview Image formation and OpenGL Transformations and viewing Polygons and polygon meshes 3D model/mesh representations Illumination and polygon shading OpenGL rasterization: hidden surface removal, interpolation, texturing (all image-space!) Modeling and animation Rendering 10/18/2010 3

Topic overview Image formation and OpenGL Transformations and viewing Polygons and polygon meshes Programmable pipelines Modeling and animation Rendering OpenGL rasterization: hidden surface removal, interpolation, texturing (some sampling theory) Raytracing and radiosity 10/18/2010 4

Topic overview Image formation and OpenGL Transformations and viewing Polygons and polygon meshes Programmable pipelines Modeling and animation Rendering Object space hidden surface removal, bump mapping and other texture tricks Raytracing and radiosity 10/18/2010 5

Textures Reality provide a wide spectrum of geometric shapes and physical materials Structures in wood, marble, wallpaper, clouds Far-away background scenery, buildings and trees Modeling the exact geometric form of these objects is too complex and not necessary No/small parallax effects for distant scenery + only cover a few pixels Can be performed in a fragment shader (more later...) 10/18/2010 6

Textures Make simple objects appear significantly more complex Model wall, mirror or window as planar surface Apply an image to the window to model the distant scenery 10/18/2010 7

Texture mapping 2D-textures are functions that map points (u,v) in texture space to (r,g,b) colors ( r, g, b) = C ( uv, ) The mapping describes how to decorate the surface For rendering, we need the inverse mapping from known (x,y,z) coordinates to (u,v) points tex ( uv, ) = F ( x, y, z) inv map 10/18/2010 8

Texture mapping Texture mapping uses barycentric coordinates (u,v) provided at vertices gltexcoordxx(...) Texture space Object space 10/18/2010 9

Texture mapping Mathematically, this is described by concatenation of two mappings 3D-textures are functions that map points of (u,v,w) space to (r,g,b) colors 2D ( r, g, b) = C ( F ( x, y, z)) tex inv map ( r, g, b) = C ( uvw,, ) tex 10/18/2010 10

Texture mapping 3D textures are known as solid textures Examples: wood and marmorite Interpretation: the shape is carved out of the(u,v,w) texture space ( r, g, b) = C ( uvw,, ) tex 10/18/2010 11

Grid of color values (texels) Texture representation Discrete textures Three/four scalar quantities per texel(rgba) n x m texture is simply a pixel image with 3(4) tuplesstored at integer coordinates { C [ i, j] 0 i< n, 0 j< m} 10/18/2010 12

Easy to acquire with cameras,scanners etc. Generatingcomplex textures using cameras and procedural methods simplifies photorealism Discrete textures Advantages 10/18/2010 13

Discrete textures Problems Large texture memory consumption Magnifying textures leads to blurriness Tiling a surface with textures is complicated The texture lighting is not necessarily coherent with the lighting in the scene Texture mapping on surfaces is in general not free of distortion (parameterization, CS 523) Texture values C tex (u,v) at positions (u,v) need to be reconstructed, interpolated and filtered 10/18/2010 14

Red: screen pixel Grey: texel Discrete textures Reconstruction Magnification (Oversampling) Minification (Undersampling) 10/18/2010 15

1. nearest neighbor filtering Discrete textures Reconstruction C ( uv, ) tex C un, vm : u<1,v<1 C n 1, vm : u=1,v<1 = C un, m 1 : u<1,v=1 C n 1, m 1 : u=1,v=1 vm un i i+ 1 10/18/2010 16

2. bilinear interpolation Discrete textures Reconstruction uˆ = un un vˆ = vm vm 1 0 vm +1 vm C ˆ ˆ 0( uv, ) = u * C un + 1, vm + (1 u)* C un, vm C ˆ ˆ 1( uv, ) = u * C un + 1, vm + 1 + (1 u)* C un, vm + 1 C ( uv, ) = vˆ * C ( uv, ) + (1 vˆ )* C ( uv, ) tex vm un un C 1 C 0 C tex un +1 10/18/2010 17

Bilinear interpolation is a good approximation Better: convolution with a sincfilter Discrete textures Reconstruction See http://www.jhu.edu/ ~signals/sampling/ 10/18/2010 18

Nearest neighbor filtering is insufficient for texture minification Undersamplingerrors create aliasing artifacts Discrete textures Filtering 10/18/2010 19

Magnification (pixelation, blurring) is generally preferred over aliasing Achieved by reducing original texture res. Discrete textures Filtering 10/18/2010 20

Discrete textures Filtering Footprint: projection of the cell associated with a screen pixel (x,y) to texture (u,v) space Approximated by a parallelogram, spanned by the vectors u v t u v t r1 = (, ), r2 = (, ) x x y y 10/18/2010 21

For real-time texture filtering Discrete textures Filtering Replace the actual footprint by a union of simpler surfaces Such that the filtered texture value can be precomputed 10/18/2010 22

Discrete textures Filtering: mip-map A 2n 2n mip-map C mip [i,j] stores a 2D texture C[i,j] of size n nwhere n = 2 k sequentially at half the previous resolution Color channels in full resolution Next smaller resolution (filtered) 10/18/2010 23

Level d=0 are the original texture values C i j Ci j 0 k mip[, ] = [, ], 0 i,j<2. Discrete textures Filtering: mip-map All other levels are constructed by filtering the previous resolution (weighted summation) d 1 d d d d Cmip[ i, j] = Cmip [2 i, 2 j] + Cmip [2i+ 1, 2 j] + Cmip [2 i,2j+ 1] + Cmip [2i+ 1,2j + 1] 4 d < k i j< ( 1 1 1 1 ) k-d 1-1 und and 0, 2. 10/18/2010 24

On level d of the texture hierarchy, 2 2d texels of the original texture are represented as a single texel In the application, pixel values are interpolated from two levels depending on the size of the footprint This known as trilinear filtering Discrete textures Filtering: mip-map 10/18/2010 25

Discrete textures Filtering: mip-map For a rectangular footprint, l=max(a,b) Too small footprints (e.g. (a+b)/2) can lead to aliasing (too large footprints to blurring) Texture value at level d=log 2 (l) is d C ( uvd,, ) = BiLinIntC (, uv, ) tex When d is not an integer value mip Interpolate between two levels d und d d + 1 d tex = mip + + mip C ( uvd,, ) ( d d )* BiLinIntC (, uv, ) ( d 1 d)* BiLinInt( C, uv, ). 10/18/2010 26

Discrete textures Filtering: footprint assembly Square projection ignores anisotropy! Idea:use multiple mip-mapaccesses to cover the footprint parallelogram Anisotropic texture filteringin real time Number of square parts determines the quality of the anisotropic filter 10/18/2010 27

Discrete textures Filtering: footprint assembly Mip-mapping Anisotropic filtering 10/18/2010 28

Texturing surfaces How to determine the texture coordinates for the vertices of a polygonal model? They might be given by a modeler If not, embed the complex object in a simpler object for which a simple (u,v) parameterization exists Project from the polygonal model onto the simpler object Examples: cylinder, sphere, box 10/18/2010 29

Cylinder mapping Parameterizaton: rotation angle φand height h Points interior to the cylinder are projected orthogonally from the axis to the cylinder surface Interpret (φ,h) parameters as (u,v) texture coordinates 10/18/2010 30

Sphere mapping Polar coordinates φ and θ Project points (x,y,z) on the interior through the midpoint (x s,y s,z s ) onto the sphere Interpret (φ,θ) as (u,v) π u= + arctan2 2π ( y y, x x ) s s = arctan2 v= 2 ( x x ) + ( y y ) s π s 2, z z s 10/18/2010 31

Box mapping ( x x ) ( y y ) ( z z ) box,max box,min box,max box,min box,max box,min u= x x x box,max box,min x box,min v= y y y box,max box,min y box,min Sphere mapping Box mapping 10/18/2010 32