Computer Graphics. - Texturing Methods -

Similar documents
Computer Graphics. - Texturing - Philipp Slusallek

CPSC / Texture Mapping

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

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

Computer Graphics I Lecture 11

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

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

Texture. Detail Representation

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

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

More Texture Mapping. Texture Mapping 1/46

CHAPTER 1 Graphics Systems and Models 3

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

Topics and things to know about them:

Textures and normals in ray tracing

Texture mapping. Computer Graphics CSE 167 Lecture 9

CS 130 Final. Fall 2015

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

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

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

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

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

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

Einführung in Visual Computing

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

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

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

Texture. Texture Maps

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

Texture Mapping and Sampling

INF3320 Computer Graphics and Discrete Geometry

Surface Rendering. Surface Rendering

Shading. Flat shading Gouraud shading Phong shading

3D Rasterization II COS 426

CS 5600 Spring

CMSC427 Final Practice v2 Fall 2017

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

CS 431/636 Advanced Rendering Techniques

Computer Graphics. Lecture 13. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura

Computer Graphics. Illumination Models and Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

CPSC GLOBAL ILLUMINATION

Subdivision Of Triangular Terrain Mesh Breckon, Chenney, Hobbs, Hoppe, Watts

Review. Stephen J. Guy

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

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

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

Multiple Importance Sampling

Introduction Ray tracing basics Advanced topics (shading) Advanced topics (geometry) Graphics 2010/2011, 4th quarter. Lecture 11: Ray tracing

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

03 RENDERING PART TWO

Computer Graphics. Lecture 10. Global Illumination 1: Ray Tracing and Radiosity. Taku Komura 12/03/15

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

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

CS 354R: Computer Game Technology

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

Texture and other Mappings

Ray tracing. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 3/19/07 1

Textures III. Week 10, Wed Mar 24

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

Introduction to Computer Graphics 7. Shading

Chapter 10. Surface-Rendering Methods. Somsak Walairacht, Computer Engineering, KMITL

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

Computer Graphics. Shadows

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

Texture Mapping. Brian Curless CSE 457 Spring 2016

Real-Time Shadows. Last Time? Textures can Alias. Schedule. Questions? Quiz 1: Tuesday October 26 th, in class (1 week from today!

Surface Modeling. Polygon Tables. Types: Generating models: Polygon Surfaces. Polygon surfaces Curved surfaces Volumes. Interactive Procedural

6. Illumination, Lighting

Barycentric Coordinates and Parameterization

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

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

Computer Graphics 7 - Texture mapping, bump mapping and antialiasing

Images from 3D Creative Magazine. 3D Modelling Systems

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

Computergrafik. Matthias Zwicker. Herbst 2010

Level of Details in Computer Rendering

Computer Graphics. Shading. Based on slides by Dianna Xu, Bryn Mawr College

Central issues in modelling

Complex Shading Algorithms

Computer Graphics 10 - Shadows

Computer Graphics. - Ray Tracing I - Marcus Magnor Philipp Slusallek. Computer Graphics WS05/06 Ray Tracing I

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

Introduction to Computer Graphics

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E.

COM337 COMPUTER GRAPHICS Other Topics

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

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

Chapter 2 A top-down approach - How to make shaded images?

Sung-Eui Yoon ( 윤성의 )

SUMMARY. CS380: Introduction to Computer Graphics Ray tracing Chapter 20. Min H. Kim KAIST School of Computing 18/05/29. Modeling

lecture 18 - ray tracing - environment mapping - refraction

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

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

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

6.837 Introduction to Computer Graphics Quiz 2 Thursday November 20, :40-4pm One hand-written sheet of notes allowed

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

Transcription:

Computer Graphics - Texturing Methods -

Overview Last time BRDFs Shading Today Texturing Texture parameterization Procedural methods Procedural textures Fractal landscapes Next lecture Texture filtering Alias & signal processing 2

TEXTURING 3

Simple Illumination No illumination Constant colors Parallel light Diffuse reflection 4

Standard Illumination Parallel light Specular reflection Multiple local light sources Different BRDFs Object properties constant over surface 5

Texturing Varying object properties 2D image reflectance textures Bump-mapping Environment characteristics Shadows Reflection textures 6

Texture-Modulated Quantities Modulation of object surface properties Reflectance Diffuse reflection coefficient k d Specular reflection coefficient k s Opacity (α) Modulating transparency (e.g. for fences) Normal vector Bump mapping: N (P) = N(P + t N) (in normal direction, height) Normal mapping: N = N + Δ N (arbitrary offset) Geometry Displacement mapping: P = P + Δ P Distant illumination Environment mapping / reflection mapping 7

2D Texture Mapping Forward mapping Object surface parameterization Projective transformation Inverse mapping Find corresponding pre-image/footprint of each pixel in texture Integrate over pre-image 8

Forward Mapping Maps each texel to its position in the image Uniform sampling of texture space does not guarantee uniform sampling in screen space Can create holes, need to scan-convert (see later) Possibly used if The texture-to-screen mapping is difficult to invert The texture image does not fit into memory Process texture in tiles in order Texture scanning: for v for u compute x(u,v) and y(u,v) copy TEX[u,v] to SCR[x,y] 9

Surface Parameterization To apply textures we need 2D coordinates on surfaces Parameterization Some objects have a natural parameterization Sphere: spherical coordinates (φ, θ) = (2π u, π v) Cylinder: cylindrical coordinates (φ, h) = (2 π u, H v) Parametric surfaces (such as B-spline or Bezier surfaces later) Parameterization is less obvious for Polygons, implicit surfaces, teapots 10

Triangle Parameterization Triangle is a planar object Has implicit parameterization (e.g. barycentric coordinates) But we need more control: placement of triangle in texture space Assign texture coordinates (u,v) to each vertex (x o,y o,z o ) Apply viewing projection (x o,y o,z o ) (x,y) (details later) Yields full texture transformation (warping) (u,v) (x,y) In homogeneous coordinates (by embedding (u,v) as (u,v,1)) Transformation coefficients determined by 3 pairs (u,v) (x,y) Three linear equations Invertible iff neither set of points is collinear 11

Triangle Parameterization (2) Given The inverse transform (x,y) (u,v) is Coefficients must be calculated for each triangle Rasterization Incremental bilinear update of (u,v,q) in screen space Using the partial derivatives of the linear function (i.e. constants) Ray tracing Evaluated at every intersection Often derivatives are needed as well Explicitly given in matrix 12

Cylinder Parameterization Transformation from texture space to the cylinder parametric representation can be written as: where H is the height of the cylinder. The surface coordinates in the Cartesian reference frame can be uniquely expressed as: 13

Two-Stage Mapping Inverse mapping for arbitrary 3D surfaces too complex Approximation technique is used: Mapping from 2D texture space to a simple 3D intermediate surface (S mapping) Should be a reasonable approximation of the destination surface E.g.: plane, cylinder, sphere, cube,... Mapping from the intermediate surface to the destination object surface (O mapping) S O 14

O-Mapping Determine point on intermediate surface through Reflected view ray Reflection or environment mapping Normal mapping Line through object centroid Shrink-wrapping Forward mapping Normal mapping from intermediate surface 15

Two-Stage Mapping: Problems May introduce undesired texture distortions if the intermediate surface differs too much from the destination surface Still often used in practice because of its simplicity 16

Two-Stage Mapping: Example Different intermediate surfaces Plane Strong distortion where object surface normal to plane normal Cylinder Reasonably uniform mapping (symmetry!) Sphere Problems with concave regions 17

Projective Textures Project texture onto object surfaces Slide projector Parallel or perspective projection Use photographs as textures Multiple images View-dependent texturing (advanced topic) Perspective mapping 18

Projective Texturing: Examples 19

Reflection Mapping Also called environment mapping Reflection map parameterization Intermediate surface in 2-stage mapping Often cube, sphere, or double paraboloid Assumption: Distant illumination Parallax-free illumination No self-reflections, distortion of near objects Option: Separate map per object Often necessary to be reasonably accurate Reflections of other objects Maps must be recomputed after changes Mirror reflections Surface curvature: beam tracing Map filtering 20

Reflection Map Acquisition Generating spherical maps (original 1982/83) I.e. photo of a reflecting sphere (gazing ball) 21

Reflection Map Rendering Spherical parameterization O-mapping using reflected view ray intersection 22

Reflection Map Parameterization Spherical mapping Single image Bad utilization of the image area Bad scanning on the edge Artifacts, if map and image do not have the same view point Double parabolic mapping Yields spherical parameterization Subdivide in 2 images (front-facing and back-facing sides) Less bias near the periphery Arbitrarily reusable Supported by OpenGL extensions 23

Reflection Map Parameterization Cubical environment map, cube map, box map Enclose object in cube Images on faces are easy to compute Poorer filtering at edges Support in OpenGL 24

Reflection Mapping Example Terminator II motion picture 25

Reflection Mapping Example II Reflection mapping with Phong reflection Two maps: diffuse & specular Diffuse: index by surface normal Specular: indexed by reflected view vector RenderMan Companion 26

Ray Tracing vs. Reflection Map Differences? 27

Recursive Ray Tracing How to fake it with reflection mapping? 28

Light Maps Light maps (e.g. in Quake) Pre-calculated illumination (local irradiance) Often very low resolution: smoothly varying Multiplication of irradiance with base texture Diffuse reflectance only Provides surface radiosity View-independent out-going radiance Animated light maps Animated shadows, moving light spots, etc mesh texture Reflectance Irradiance Radiosity Representing radiosity in a mesh or texture 29

Bump Mapping Modulation of the normal vector Surface normals changed only Influences shading only No self-shadowing, contour is not altered 30

Bump Mapping Original surface: O(u,v) Surface normals are known Bump map: B(u,v) ϵ R Surface is offset in normal direction according to bump map intensity New normal directions N (u,v) are calculated based on virtually displaced surface O (u,v) Original surface is rendered with new normals N (u,v) Grey-valued texture used for bump height 31

Bump Mapping Normal is cross-product of derivatives: If B is small (i.e. the bump map displacement function is small compared to its spatial extent) the last term in each equation can be ignored The first term is the normal to the surface and the last is zero, giving: 32

Texture Examples Complex optical effects Combination of multiple texture effects RenderMan Companion 33

Billboards Single textured polygons Often with opacity texture Rotates, always facing viewer Used for rendering distant objects Best results if approximately radially or spherically symmetric Multiple textured polygons Azimuthal orientation: different view-points Complex distribution: trunk, branches, 34

3-D Textures Carving object shape out of material block David Ebert 35

Texture Examples Solid 3D textures (wood, marble) Bump map (middle) RenderMan Companion 36

Part II Procedural Methods

Texture Maps Procedural Textures Texture maps: paintings, photos, videos, simulation... Simple acquisition Illumination frozen during acquisition Limited resolution, aliasing High memory requirements Mapping issues Procedural textures Non-trivial programming Flexibility & parametric control Unlimited resolution Anti-aliasing possible Low memory requirements Low-cost visual complexity Can adapt to arbitrary geometry 38

Procedural Textures Function of some shading parameter E.g. world space, texture coordinates,... Texturing: evaluation of function on object surface Ray tracing: at intersection point with surface Must be able to evaluate at random position efficiently Observation: textures of natural objects Similarity between patches at different locations Repetitiveness, coherence (e.g. skin of a tiger or zebra) Similarity on different resolution scales Self-similarity But never completely identical Additional disturbances, turbulence, noise Goal: generic procedural texture function Mimics statistical properties of natural textures Purely empirical approach Looks convincing, but has nothing to do with material s physics 39

Texture Examples Translational similarity Similarity on different scales Romanesco broccoli [Wikipedia] 40

3D / Solid Noise: Perlin Noise Noise(x,y,z) Statistical invariance under rotation Statistical invariance under translation Roughly one specific frequency Integer lattice (i,j,k) Fixed fundamental frequency of ~1 Hz over lattice Don t store all values use a hash function to randomize and look up from a fixed-size table Value noise: Random value at lattice Gradient noise: Random gradient vector at lattice point Q: G(Q) Value at point P: G (P-Q) Tri-linear interpolation or cubic interpolation Hermite spline later Unlimited domain due to lattice and hashing Also see http://www.noisemachine.com/talk1/ http://www.cs.cmu.edu/~mzucker/code/perlin-noise-math-faq.html 41

Noise vs. Noise Gradient noise better than value noise Less regularity artifacts More high frequencies in noise spectrum Even tri-linear interpolation produces good results Comparison between random values and Perlin noise Random values at each pixel Gradient noise 42

Turbulence Function 43

Synthesis of Turbulence (1D) 44

Synthesis of Turbulence (2D) 45

Example: Marble Texture Function Overall structure: alternating layers of white and colored marble f marble (x,y,z) := marble_color(sin(x)) marble_color : transfer function (see lower left) Realistic appearance: simulated turbulence f marble (x,y,z) := marble_color(sin(x+turbulence(x,y,z))) Moving object: turbulence function also transformed 46

Further Procedural Texturing Applications Bark Turbulated sawtooth function Bump mapping Clouds White blobs Turbulated transparency along edge Transparency mapping Animation Vary procedural texture function s parameters over time 47

Fractal Landscapes Procedural generation of geometry Complex geometry at virtually no memory cost Can be difficult to ray trace!! 48

Fractal Landscapes Coarse triangle mesh approximation 1:4 triangle subdivision Vertex insertion at edge-midpoints New vertex perturbation Random displacement along normal Scale of perturbation depends on subdivision level Decreasing power spectrum Parameter models surface roughness Recursive subdivision Level of detail (LOD) determined by # subdivisions All done inside renderer! LOD generated locally when/where needed (bounding box test) Minimal I/O cost (coarse mesh only) 49

Fractal Landscapes Triangle subdivision Insert new vertices at edge midpoints 1:4 triangle subdivision Vertex displacement Along original triangle normal Courtesy http://www.uni-paderborn.de/sfb376/projects/a2/zbuffermerging/ 50

Fractal Landscape Generation Base mesh Repeated subdivision & vertex displacement Shading + Water surface + Fog + Courtesy http://www.uwp.edu/academic/computer.science/morris.csci/cs.320/week.11/ch11b.www/ch11b.html 51

Fractal Landscape Ray Tracing Fractal terrain generated on-the-fly Problem: where is the ray-surface interaction? Triangle mesh not a-priori known Solution: bounding boxes Maximum possible bounding box around each triangle Decreasing displacement amplitude: finite bounding box Algorithm Intersect ray with bounding box If hit, subdivide corresponding triangle Compute bounding boxes of 4 new triangles Test against 4 new bounding boxes Iterate until termination criterion fulfilled (LOD / pixel size) 52