Computer Graphics 7 - Texture mapping, bump mapping and antialiasing

Similar documents
Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

Texture mapping. Computer Graphics CSE 167 Lecture 9

Computer Graphics 10 - Shadows

Computer Graphics. Lecture 14 Bump-mapping, Global Illumination (1)

Computer Graphics 7 - Rasterisation

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

3D Rasterization II COS 426

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

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

Einführung in Visual Computing

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

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

Texturing. Texture Mapping. Texture Mapping. Have seen: colour can be assigned to ver7ces But: don t want to represent all this detail with geometry

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

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

Texture Mapping and Sampling

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

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

CS 130 Final. Fall 2015

Texture and other Mappings

Pipeline Operations. CS 4620 Lecture 10

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

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

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

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

CS 431/636 Advanced Rendering Techniques

CT5510: Computer Graphics. Texture Mapping

CS 5600 Spring

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

Computer Graphics. - Texturing Methods -

Textures. Texture coordinates. Introduce one more component to geometry

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

Point-Based Rendering

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

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

CPSC / Texture Mapping

Computer Graphics. Shadows

Topic 11: Texture Mapping 10/21/2015. Photographs. Solid textures. Procedural

Bump Mapping Which one of these two image has a better visual effect?

Computer Graphics. Lecture 9 Environment mapping, Mirroring

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

INF3320 Computer Graphics and Discrete Geometry

Shading. Flat shading Gouraud shading Phong shading

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

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Textures and normals in ray tracing

INF3320 Computer Graphics and Discrete Geometry

CS 498 VR. Lecture 19-4/9/18. go.illinois.edu/vrlect19

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

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

Texture Mapping 1/34

Perspective Projection and Texture Mapping

Spring 2009 Prof. Hyesoon Kim

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

Today. Anti-aliasing Surface Parametrization Soft Shadows Global Illumination. Exercise 2. Path Tracing Radiosity

Texture Mapping and Special Effects

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

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

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

Barycentric Coordinates and Parameterization

Review of Tuesday. ECS 175 Chapter 3: Object Representation

Advanced Shading and Texturing

CS 4620 Midterm, March 21, 2017

Data Representation in Visualisation

Surface shading: lights and rasterization. Computer Graphics CSE 167 Lecture 6

Surface Rendering. Surface Rendering

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

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

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

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

More Texture Mapping. Texture Mapping 1/46

Computer Graphics Introduction. Taku Komura

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Graphics and Interaction Rendering pipeline & object modelling

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

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

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

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

lecture 16 Texture mapping Aliasing (and anti-aliasing)

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

Texture. Detail Representation

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

Displacement Mapping

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.

Input Nodes. Surface Input. Surface Input Nodal Motion Nodal Displacement Instance Generator Light Flocking

Sung-Eui Yoon ( 윤성의 )

Point based Rendering

TSBK03 Screen-Space Ambient Occlusion

CS 4620 Program 3: Pipeline

Computer Graphics I Lecture 11

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

CS 354R: Computer Game Technology

Shading. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller/Fuhrmann

You can select polygons that use per-poly UVs by choosing the Select by Polymap command ( View > Selection > Maps > Select by Polygon Map).

Texture Mapping. Brian Curless CSE 457 Spring 2015

Spring 2011 Prof. Hyesoon Kim

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

Transcription:

Computer Graphics 7 - Texture mapping, bump mapping and antialiasing Tom Thorne Slides courtesy of Taku Komura www.inf.ed.ac.uk/teaching/courses/cg

Overview Texture mapping and bump mapping Anti-aliasing

Texture mapping Adding detail to polygon meshes to build high resolution models is computationally expensive In realtime applications these are not practical to use by Rami Ali Al-ashqar

Texture mapping We can improve the appearance of polygons by mapping images onto their surface This is done during rasterisation

Overview of texture mapping Assign each triangle in the mesh a region of the image During rasterisation, colour the surface of the triangle based on the pixels in the image Typically done by assigning triangle vertices coordinates (uv) within the image

Interpolation of uv coordinates To calculate which pixel in the image corresponds to a point inside the triangle, we interpolate uv coordinates between vertices This can be done using barycentric coordinates u= α u1 + β u2 + γ u3 v = α v1 + β v2 + γ v3

Example

Producing uv mappings Generated based on the mesh - cylindrical, spherical, orthogonal Captured from real objects by scanning Manually specifying coordinates

Common uv mappings Orthogonal Cylindrical Spherical

Capturing real data Scanning depth and colour of objects http://www.3dface.org/media/ images.html

Manual specification Painting on the geometry (Z-brush) Manually aligning an unfolded model on the image

Geometry unfolding Segment the mesh into regions that are arranged in a 2D plane Draw on these regions in 2D to texture the mesh Levy et al. SIGGRAPH 2002

Linear interpolation Linearly interpolating uv coordinates does not produce the expected results texture source what we get what we want

Why does this happen? Uniform steps in 2D screen space do not correspond to uniform steps over the surface of the triangle

Hyperbolic interpolation To interpolate between vertices P and Q, rather than interpolating between u(p) and u(q), we interpolate u(p)/z, u(q)/z and 1/z Considering a point M between P and Q and its projection M : P 0 = P/z P,Q 0 = Q/z Q M 0 = P 0 +(1 )Q 0

Hyperbolic interpolation For a point M the perspective correct interpolated u(m) is then: u(m) z M = u(p ) z P +(1 ) u(q) u(m) = u(p ) z P +(1 ) u(q) z Q 1 z P +(1 ) 1 z Q z Q

Example Linear interpolation vs hyperbolic interpolation

Texture mapping and illumination We can use texture information to alter illumination

Bump mapping Texture mapping leaves the surface looking flat Adding extra mesh detail can be computationally too expensive

Bump mapping Uses a texture to alter the surface normal to change the illumination Applied during rasterisation Sphere w/diffuse Texture Swirly Bump Map Sphere w/diffuse Texture & Bump Map

Bump mapping Calculate finite differences from the bump map F u = df du,f v = df dv Calculate a perturbed normal vector

Displacement mapping Bump mapping only changes shading of the surface, not the actual geometry Displacement mapping alters the surface using the texture as a mesh defined in uv coordinates

Displacement mapping Subdivide the surface to resolution of texture Displace vertices in normal direction of surface by height in displacement map

Overview Texture mapping Bump mapping Anti-aliasing

Anti-aliasing Aliasing is the distortion produced by representing a high resolution signal at a lower resolution Anti-aliasing aims to remove this distortion Aliased polygons (jagged edges) Anti-aliased polygons

Why does aliasing happen? When the sampling frequency is too low to represent the signal

Nyquist limit f signal =0.8f sample f signal =0.5f sample To reproduce a signal, the sampling frequency should be twice the signal frequency f signal < 0.5f sample

Anti-aliasing by subsampling Subdivide each pixel into n regions Colour each sub-pixel Calculate average colour

Subsampling schemes

Subsampling schemes

Stochastic sampling Regular patterns still exhibit some aliasing for very small details Random sampling causes higher frequency signals to appear as noise rather than aliasing Our eyes are more sensitive to aliasing than noise

Stochastic sampling Subdivide pixels into n regions and randomly sample within those regions Calculate colours for each subsample and average Either precompute a table of sample positions or calculate them in real time

Comparison

Accumulation buffers Use a buffer of the same size as the target image Pixel center Subsampled point Shift the frame buffer around each pixel center Accumulate and average

Antialiasing textures When textures are zoomed in, individual texture pixels (texels) are clearly visible When zoomed out, several texels could be mapped to a single pixel

Magnification

Bilinear interpolation Averaging the neighbouring texels based on the uv coordinates for the current pixel

Bilinear interpolation Colour is calculated from coordinates by interpolation, with u and v the distance from the rounded down coordinates u 0 =p u (int)p u,v 0 = p v (int)p v c(p u,p v )=(1 u 0 )(1 v 0 )t(x l,y b )+u 0 (1 v 0 )t(x r,y b ) +(1 u 0 )v 0 t(x l,y t )+u 0 v 0 t(x r,y t )

Minification When textures are zoomed out, multiple texels fall inside a single pixel. Causes aliasing due to the Nyquist limit

MIP mapping Textures are produced at multiple resolutions Resolutions are switched depending on number of texels in a pixel Select a resolution where ration of texels to pixel is 1:1

MIP mapping Map pixel corners to texture space Find a resolution where texel size is close to the pixel size Alternatively, use trilinear interpolation between multiple resolutions

Example Standard MIP mapping

References Texture mapping - Shirley Chapter 11 (Texture mapping), https://www.comp.nus.edu.sg/~lowkl/publications/ lowk_persp_interp_techrep.pdf Bump mapping - Akenine-Möller Chapter 6.7 (6.7.1) Bump mapping. Blinn, J. F. (1978). Simulation of wrinkled surfaces. ACM SIGGRAPH Computer Graphics, 12(3). Anti-aliasing - Shirley Chapter 8.2 (Simple anti-aliasing), Akenine-Möller Chapter 5.6.2 (Screen-based anti-aliasing), Chapter 6.2.1,6.2.2 (Magnification and Minification)