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

Similar documents
CS 431/636 Advanced Rendering Techniques

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

CSE528 Computer Graphics: Theory, Algorithms, and Applications

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

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

Sampling, Aliasing, & Mipmaps

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.

Texture mapping. Computer Graphics CSE 167 Lecture 9

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

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

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

Sampling, Aliasing, & Mipmaps

More Texture Mapping. Texture Mapping 1/46

3D Rasterization II COS 426

Programmable GPUS. Last Time? Reading for Today. Homework 4. Planar Shadows Projective Texture Shadows Shadow Maps Shadow Volumes

frame buffer depth buffer stencil buffer

Texture Mapping. Brian Curless CSE 457 Spring 2016

CS 354R: Computer Game Technology

Sampling, Aliasing, & Mipmaps

Computer Graphics 7 - Texture mapping, bump mapping and antialiasing

Shading. Flat shading Gouraud shading Phong shading

Computer Graphics. - Texturing Methods -

The Traditional Graphics Pipeline

The Traditional Graphics Pipeline

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

TEXTURE MAPPING. DVA338 Computer Graphics Thomas Larsson, Afshin Ameri

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

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

CS 130 Final. Fall 2015

Texture Mapping. Most slides courtesy of Leonard McMillan and Jovan Popovic

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

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

Texture and other Mappings

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

521493S Computer Graphics. Exercise 3

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

Texture Mapping. Michael Kazhdan ( /467) HB Ch. 14.8,14.9 FvDFH Ch. 16.3, , 16.6

Einführung in Visual Computing

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

Computer Graphics Ray Casting. Matthias Teschner

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

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

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

The Traditional Graphics Pipeline

Computer Graphics. Lecture 8 Antialiasing, Texture Mapping

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

Soft shadows. Steve Marschner Cornell University CS 569 Spring 2008, 21 February

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

Texture Mapping. Brian Curless CSE 457 Spring 2015

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

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

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

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

Topics and things to know about them:

Texture. Detail Representation

lecture 18 - ray tracing - environment mapping - refraction

CS 4620 Program 3: Pipeline

Computergrafik. Matthias Zwicker. Herbst 2010

CT5510: Computer Graphics. Texture Mapping

Shadow Rendering EDA101 Advanced Shading and Rendering

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

Surface Rendering. Surface Rendering

Rendering and Radiosity. Introduction to Design Media Lecture 4 John Lee

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

CPSC / Texture Mapping

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

Assignment 6: Ray Tracing

surface: reflectance transparency, opacity, translucency orientation illumination: location intensity wavelength point-source, diffuse source

Lecture 17: Shadows. Projects. Why Shadows? Shadows. Using the Shadow Map. Shadow Maps. Proposals due today. I will mail out comments

Graphics Hardware and Display Devices

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

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

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

Schedule. MIT Monte-Carlo Ray Tracing. Radiosity. Review of last week? Limitations of radiosity. Radiosity

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

Tutorial 4: Texture Mapping Techniques

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

Visualizer An implicit surface rendering application

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

Procedural Modeling. Last Time? Reading for Today. Reading for Today

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

COMP environment mapping Mar. 12, r = 2n(n v) v

Lecture 18: Primer on Ray Tracing Techniques

COMP 175 COMPUTER GRAPHICS. Lecture 11: Recursive Ray Tracer. COMP 175: Computer Graphics April 9, Erik Anderson 11 Recursive Ray Tracer

Graphics and Interaction Rendering pipeline & object modelling

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

Ray Tracing. Kjetil Babington

CHAPTER 1 Graphics Systems and Models 3

Autodesk Fusion 360: Render. Overview

Sung-Eui Yoon ( 윤성의 )

CS 465 Program 5: Ray II

Advanced Rendering Techniques

Introduction to Digital Modelling and Animation in Design week 4 Textures

Multiple Importance Sampling

CS 4620 Program 4: Ray II

Ray Tracing III. Wen-Chieh (Steve) Lin National Chiao-Tung University

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

Intro to Ray-Tracing & Ray-Surface Acceleration

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

This work is about a new method for generating diffusion curve style images. Although this topic is dealing with non-photorealistic rendering, as you

Transcription:

Texture-Mapping Tricks Filtering Textures Textures and Shading Bump Mapping Solid Textures How Bad Does it Look? Let's take a look at what oversampling looks like: Click and drag the texture to rotate the plane. Notice how details in the texture, in particular the motar between the bricks, tend to pop (disappear and reappear). This popping is most noticable around details (parts of the texture with a high-spatial frequency). This is indicative of aliasing (high-frequency details showing up in areas wher we expect to see low frequencies). Lecture 21 Slide 1 6.837 Fall '00 Lecture 21 Slide 3 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide01.html [11/30/2000 6:03:27 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide03.html [11/30/2000 6:03:33 PM] Sampling Texture Maps When texture mapping it is rare that the screen-space sampling density matches the sampling density of the texture. Typically one of two things can occur: We've Seen this Sort of Thing Before Remember...Aliasing? This was the phenomenon that occurred when we undersampled a signal. It caused certain high frequency features to appear as low frequencies. To eliminate aliasing we had to either band limit (low pass filter) our input signal or sample it at a higher rate: Oversamping of the texture or Undersampling of the texture In the case of oversampling we already know what to do... interpolation (review on Antialiasing and Resampling). But, how do we handle undersampling? Lecture 21 Slide 2 6.837 Fall '00 Lecture 21 Slide 4 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide02.html [11/30/2000 6:03:32 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide04.html [11/30/2000 6:03:35 PM]

Spatial Filtering In order to get the sort of images the we expect, we must prefilter the texture to remove the high frequencies that show up as artifacts in the final rendering. The prefiltering required in the undersampling case is basically a spatail integration over the extent of the sample. Storing MIP Maps One convenient method of storing a MIP map is shown below. (It also nicely illustrates the 1/3 overhead of maintaining the MIP map). We could perform this filtering while texture mapping (during rasterization), by keeping track of the area enclosed by sequential samples and performing the integration as required. However, this would be expensive. The most common solution to undersampling is to perform prefiltering prior to rendering. We must make a few small modifications to our rasterizer to compute the MIP map level. Recall the equations that we derived for mapping screen-space interpolants to their 3-space equivalent. Lecture 21 Slide 5 6.837 Fall '00 Lecture 21 Slide 7 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide05.html [11/30/2000 6:03:36 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide07.html [11/30/2000 6:03:43 PM] MIP Mapping MIP Mapping is one popular technique for precomputing and performing this prefiltering. MIP is an acronym for the latin phrase multium in parvo, which means "many in a small place". The technique was first described by Lance Williams. The basic idea is to construct a pyramid of images that are prefiltered and resampled at sampling frequencies that are a binary fractions (1/2, 1/4, 1/8, etc) of the original image's sampling. While rasterizing we compute the index of the decimated image that is sampled at a rate closest to the density of our desired sampling rate (rather than picking the closest one can in also interpolate between pyramid levels). Computing this series of filtered images requires only a small fraction of addtional storage over the original texture (How small of a fraction?). Finding the MIP level What we'd like to find is the step size that a uniform step in screen-space causes in three-space, or, in other words how a screen-space change relates to a 3-space change. This sounds like the derivatives, ( du/dt, dv/dt ). They can be computed simply using the chain rule: Notice that the term being squared under the numerator is just the w plane equation that we are already computing. The remaining terms are constant for a given rasterization. Thus all we need to do to compute the derivative is a square the w accumulator and multiply it by a couple of constants. Now, we know how a step in screen-space relates to a step in 3-space. So how do we translate this to an index into our MIP table? Lecture 21 Slide 6 6.837 Fall '00 Lecture 21 Slide 8 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide06.html [11/30/2000 6:03:37 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide08.html [11/30/2000 6:03:47 PM]

MIP Indices Actually, you have a choice of ways to translate this gradient value into a MIP level. This also brings up one of the shortcomings of MIP mapping. MIP mapping assumes that both the u and v components of the texture index are undergoing a uniform scaling, while in fact the terms du/dt and dv/dt are relatively independent. Thus, we must make some sort of compromise. Two of the most common approaches are given below: Summed-Area Tables How much storage does a summed-area table require? Does it require more or less work per pixel than a MIP map? What sort of low-pass filter does a summed-area table represent? What do you remember about this sort of filter? No filtering MIP mapping Summed-Area Table The differences between these level selection methods is illustrated by the accompanying figure. These nice images were grabbed from the following web page. Lecture 21 Slide 10 6.837 Fall '00 Lecture 21 Slide 12 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide10.html [11/30/2000 6:03:48 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide12.html [11/30/2000 6:03:53 PM] Summed-Area Tables There are other approaches to computing this prefiltering integration on the fly. One, which was introduced by Frank Crow is called a summed-area table. Basically, a summed-area table is a tabularized two-dimensional cummulative distribution function. Imagine having a 2-D table of numbers the cummulative distribution function could be found as shown below. Phototextures To this point we've only used textures as labels over geometry. Their applications are much broader, however. Simple extensions include: Spatially varying surface properties: The diffuse shading coefficient, k d, could be stored as a texture. Likewise for the intrinsic color, k a, k s, and n shiny. To find the sum of region contained in a box bounded by (x 0, y 0 ) and (x 1, y 1 ): Textures can also be used in a lot of other ways T(x 1, y 1 ) - T(x 0, y 1 ) - T(x 1, y 0 ) + T(x 0, y 0 ) This approach can be used to compute the integration of pixels that lie under a pixel by dividing the resulting sum by the area of the rectangle, (y 1 - y 0 )(x 1 - x 0 ). With a little more work you can compute the area under any four-sided polygon (How?). Lecture 21 Slide 11 6.837 Fall '00 Lecture 21 Slide 13 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide11.html [11/30/2000 6:03:50 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide13.html [11/30/2000 6:03:56 PM]

Adding Texture Mapping to Illumination Texture mapping can be used to alter some or all of the constants in the illumination equation. We can simply use the texture as the final color for the pixel, or we can just use it as diffuse color, or we can use the texture to alter the normal, or... the possibilities are endless! More Bump Map Examples Phong's Illumination Model Constant Diffuse Color Diffuse Texture Color Texture used as Label Texture used as Diffuse Color Cylinder w/diffuse Texture Map Bump Map Cylinder w/texture Map & Bump Map Lecture 21 Slide 14 6.837 Fall '00 Lecture 21 Slide 16 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide14.html [11/30/2000 6:04:47 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide16.html [11/30/2000 6:04:50 PM] Bump Mapping Textures can be used to alter the surface normal of an object. This does not actual shape of the surface -- we are only shading it as if it were a different shape! This technique is called bump mapping. The texture map is treated as a single-valued height function. The value of the function is not actually used, just its partial derivatives. The partial derivatives tell how to alter the true surface normal at each point on the surface to make the object appear as if it were deformed by the height function. Since the actual shape of the object does not change, the silhouette edge of the object will not change. Bump Mapping also assumes that the Illumination model is applied at every pixel (as in Phong Shading or ray tracing). One More Bump Map Example Sphere w/diffuse Texture Swirly Bump Map Sphere w/diffuse Texture & Bump Map Notice that the shadow boundaries remain unchanged. Lecture 21 Slide 15 6.837 Fall '00 Lecture 21 Slide 17 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide15.html [11/30/2000 6:04:49 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide17.html [11/30/2000 6:04:53 PM]

Displacement Mapping We use the texture map to actually move the surface point. This is called displacement mapping. How is this fundamentally different than bump mapping? Another Displacement Mapping Example Image from Ken Musgrave The geometry must be displaced before visibility is determined. Is this easily done in the graphics pipeline? In a ray-tracer? Lecture 21 Slide 18 6.837 Fall '00 Lecture 21 Slide 20 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide18.html [11/30/2000 6:04:55 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide20.html [11/30/2000 6:04:58 PM] Displacement Mapping Example It is however possible to use displacement maps when ray tracing. Image from Geometry Caching for Ray-Tracing Displacement Maps by Matt Pharr and Pat Hanrahan. Three Dimensional or Solid Textures The textures that we have discussed to this point are two-dimensional functions mapped onto two-dimensional surfaces. Another approach is to consider a texture as a function defined over a three-dimensional surface. Textures of this type are called solid textures. Solid textures are very effective at representing some types of materials such as marble and wood. Generally, solid textures are defined procedural functions rather than tabularized or sampled functions as used in 2-D (Any guesses why?) The approach that we will explore is based on An Image Synthesizer, by Ken Perlin, SIGGRAPH '85. The vase to the right is from this paper. Lecture 21 Slide 19 6.837 Fall '00 Lecture 21 Slide 22 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide19.html [11/30/2000 6:04:56 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide22.html [11/30/2000 6:04:59 PM]

Noise and Turbulence When we say we want to create an "interesting" texture, we usually don't care exactly what it looks like -- we're only concerned with the overall appearance. We want to add random variations to our texture, but in a controlled way. Noise and turbulence are very useful tools for doing just that. A noise function is a continuous funtions that varies throughout space at a uniform frequency. To create a simple noise function, consider a 3D lattice, with a random value assigned to each triple of integer coordinates: Evaluating Noise Since noise is a 3D function, we can evaluate it at any point we want. We don't have to worry about about mapping the noise to the object, we just use (x, y, z) at each point as our 3D texture coordinates! It is as if we are carving our object out of a big block of noise. Original Object Trilinear Noise Triquadratic Noise Lecture 21 Slide 23 6.837 Fall '00 Lecture 21 Slide 25 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide23.html [11/30/2000 6:05:00 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide25.html [11/30/2000 6:05:03 PM] Interpolating Noise To calculate the noise value of any point in space, we first determine which cube of the lattice the point is in. Next, we interpolate the desired value using the 8 corners of the cube: Turbulence Noise is a good start, but it looks pretty ugly all by itself. We can use noise to make a more interesting function called turbulence. A simple turbulence function can be computed by summing many different frequencies of noise functions: One Frequency Two Frequencies Three Frequencies Four Frequencies Now we're getting somewhere. But even turbulence is rarely used all by itself. We can use turbulence to build even more fancy 3D textures... Trilinear interpolation is illustrated above. Higher-order interpolation can also be used. Lecture 21 Slide 24 6.837 Fall '00 Lecture 21 Slide 26 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide24.html [11/30/2000 6:05:02 PM] http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide26.html [11/30/2000 6:05:05 PM]

Marble Example We can use turbulence to generate beautiful 3D marble textures, such as the marble vase created by Ken Perlin. The idea is simple. We fill space with black and white stripes, using a sine wave function. Then we use turbulence at each point to distort those planes. By varying the frequency of the sin function, you get a few thick veins, or many thin veins. Varying the amplitude of the turbulence function controls how distorted the veins will be. Marble = sin(f * (x + A*Turb(x,y,z))) Experiment with different values of frequency and amplitude to create new solid marble textures. Lecture 21 Slide 27 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide27.html [11/30/2000 6:05:06 PM] Next Time - Animation Lecture 21 Slide 28 6.837 Fall '00 http://graphics.lcs.mit.edu/classes/6.837/f00/lecture21/slide28.html [11/30/2000 6:05:07 PM]