1 Texture. 2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures.

Slides:



Advertisements
Similar presentations
16.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 16 – Some Special Rendering Effects.
Advertisements

Lecture 8 Transparency, Mirroring
Graphics Pipeline.
Computer Graphics I, Fall 2010 Shading II.
03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 6, 2014 TEXTURE MAPPING TEXTURES BUMP MAPPING ENVIRONMENT MAPPING PROCEDURAL TEXTURING.
Computer Graphics - Class 10
HCI 530 – Seminar in Advanced Topics 10/8/2004Damian Schofield1 Texturing Based on 3D Rendering, Humphreys, G., University of Virginia, 2004.
(conventional Cartesian reference system)
Texture Mapping from Watt, Ch. 8 Jonathan Han. Topics Discussed Texture Map to Models Bump Maps, Light Maps Environment (Reflection) Mapping 3D Textures.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Texture Mapping.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
Texture Mapping April 9, The Limits of Geometric Modeling Although graphics cards can render over 10 million polygons per second, that number.
Texture mapping. Adds realism to computer graphics Texture mapping applies a pattern of color Bump mapping alters the surface Mapping is cheaper than.
1 3D –graphics and animation Shading and Surface Characteristics Harri Airaksinen.
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Shading Week 5, Wed 1 Oct 2003 recap: lighting shading.
Basic Rendering Techniques V Recognizing basic rendering techniques.
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
1 Texturing. 2 What is Texturing? 3 Texture Mapping Definition: mapping a function onto a surface; function can be:  1, 2, or 3D  sampled (image) or.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Computer Graphics Inf4/MSc Computer Graphics Lecture 9 Antialiasing, Texture Mapping.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
3D Computer Graphics: Textures. Textures: texels Texture is a way of assigning a diffuse color to a pixel – can be with 1, 2 or 3D- can use maps, interpolation.
Texture Mapping. 2 The Limits of Geometric Modeling Although graphics cards can render over 10 million polygons per second, that number is insufficient.
Computer Graphics Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
Modelling and Simulation Types of Texture Mapping.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Noise and Procedural Techniques John Spitzer Simon Green NVIDIA Corporation.
CS 638, Fall 2001 Admin Grad student TAs may have had their accounts disabled –Please check and the lab if there is a problem If you plan on graduating.
ECSE 4750: Computer Graphics Rensselaer Polytechnic Institute Nov 5, 2012 Texture and Texture Mapping.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS 1 Shading (Shading) & Smooth Shading Graphics.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
June 9, 2008 Dr. Haim Levkowitz IVPR/CS/UML | 1 Texture.
1 Texture Mapping. 2 Texture Aliasing MIPmaps Environment Mapping Bump Mapping Displacement Mapping Shadow Maps Solid Textures Antialiasing.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
CHAPTER 8 Color and Texture Mapping © 2008 Cengage Learning EMEA.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Vector Graphics Digital Multimedia Chap 이병희
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
RENDERING Introduction to Shading models – Flat and Smooth shading – Adding texture to faces – Adding shadows of objects – Building a camera in a program.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
CS 325 Introduction to Computer Graphics 04 / 12 / 2010 Instructor: Michael Eckmann.
Real-Time Relief Mapping on Arbitrary Polygonal Surfaces Fabio Policarpo Manuel M. Oliveira Joao L. D. Comba.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Lighting and Reflection Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Module 05 –Bump mapping Module 05 – Bump mapping Module 05 Advanced mapping techniques: Bump mapping.
CS 376 Introduction to Computer Graphics 04 / 13 / 2007 Instructor: Michael Eckmann.
Mapping: Image Texturing CPSC 591/691. Texture Mapping Two-dimensional techniques place a two-dimensional (flat) image onto an object using methods similar.
CSE 681 Texture Mapping: Solid Texturing. CSE 681 Texture Mapping Visual complexity on demand Vary display properties over object Location on object used.

ATEC Procedural Animation
ATCM 3310 Procedural Animation
Graphics, Fall 2017 Lecture 24: Texture Mapping
3D Graphics Rendering PPT By Ricardo Veguilla.
So Far We have assumed that we know: The point The surface normal
Computer Animation Texture Mapping.
Procedural Animation Lecture 6: Mapping
ATCM 6317 Procedural Animation
Texture Mapping: Solid Texturing
Texture Mapping 고려대학교 컴퓨터 그래픽스 연구실.
Advanced Computer Graphics: Texture
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Adding Surface Detail 고려대학교 컴퓨터 그래픽스 연구실.
Texture Mapping: Solid Texturing
Presentation transcript:

1 Texture

2 Overview Introduction Painted textures Bump mapping Environment mapping Three-dimensional textures Functional textures Antialiasing textures OpenGL details

3 Introduction Few real objects are smooth Textures can handle large repetitions –Brick wall –Stripes Textures can handle small scale patterns –A brick’s roughness –Concrete –Wood grain Textures are typically two dimensional images of what is being simulated

4 Painted Textures A mapping of locations on the object into locations in the texture The value from the texture replaces the diffuse component in the shading calculations If the texture is larger than the object, only part of the texture is used or the texture is shrunk If the object is larger than the texture, the texture is repeated across the object or the texture is stretched

5 Painted Textures If the object location maps between texture locations, a value between them can be interpolated f 1 = fract(u) f 2 = fract(v) T 1 = (1.0 – f 1 ) * texture[trunc(u)][trunc(v)] + f 1 * texture[trunc(u)+1][trunc(v)] T 2 = (1.0 – f 1 ) * texture[trunc(u)][trunc(v)+1] + f 1 * texture[trunc(u)+1][trunc(v)+1] result = (1.0 – f 2 ) * T 1 + f 2 * T 2

6 Repeating Textures A texture can be repeated across an object with the equations:

7 Repeating Textures A repeated texture must be continuous along its edges to prevent obvious seams

8 Painted Texture Problem The texture values don’t alter the specular highlights –Specular highlighting may be inconsistent with the texture appearance

9 Bump Mapping For a real bump, the surface normal changes when moving across the bump A similar appearance can be created if a similar change is made to the surface normal for a plane

10 Bump Mapping In this case, the texture image is called a bump map The bump map is used to alter the surface normal The altered surface normal is used for the color calculations N B = bump(u, v, N) R B = 2 * N B * (N B V) – V C r = k ar + I L * [k dr * L N B + k s * (R B V) n ] C g = k ag + I L * [k dg * L N B + k s * (R B V) n ] C b = k ab + I L * [k db * L N B + k s * (R B V) n ]

11 Bump Mapping The bump function is based on the gradient of the bump map –The gradient is a measure of how much the bump map values change at the chosen location The modified normal is calculated using the gradients in two directions (B u and B v ) and two vectors tangent to the surface in those directions (S u and S v ) The parenthesized expression can also be multiplied by a factor to control the appearance of the size of the bumps

12 Bump Mapping Examples For the examples, the bump map is based on the product of the sine taken of the two coordinates: sin(10*u*π/1024) *sin(10*v*π/1024)

13 Bump Mapping Examples A bump mapped plane using factors of 1.0, 0.5, and 2.0

14 Bump Mapping Problem Because the surface shape is not changed, “bumps” near the silhouette will not change the silhouette shape If a bump mapped object is rotated, bumps will disappear when they reach the object profile

15 Displacement Mapping In displacement mapping, the object is subdivided into many very small polygons The texture values cause the vertices to be displaced in the direction of the surface normal In this case, the texture actually changes the object shape

16 Environment Mapping Environment mapping simulates reflective objects An environment map is a rendering of the scene from inside the reflective object The environment map is used to determine what would be seen in the reflection direction

17 Environment Mapping The environment map can either be spherical or cube shaped –Spherical environment maps require a calculation to convert the direction through the sphere into a two- dimensional matrix location

18 Environment Mapping A cube shaped environment map renders the scene from the center of the object onto the faces of a cube The component of the reflection vector with the largest absolute value determines the face the reflection vector goes through

19 Environment Mapping

20 Environment Mapping The location on the correct face is calculated by: Where a is the component of the reflection vector shown on the horizontal axis, b is the component shown for the vertical axis, and c is the component for the chosen face

21 Three-Dimensional Textures It is very difficult if not impossible to create a texture that can be wrapped around any irregularly shaped object without a visible discontinuity Where a two-dimensional texture is applied to the surface, an object can be thought to be carved out of a three-dimensional texture The storage requirements for a three- dimensional texture are extremely large Thus, three-dimensional textures are closely related to functional textures

22 Functional Textures Instead of using a stored image as a texture, a functional texture uses a calculation based on the texture location Because the function will be continuous in every direction, the texture is continuous in every direction Instead of requiring space, these functional textures require computation time By changing how the texture is calculated, many different textures can be created

23 Noise The beginning step to many functional textures is a noise function True white noise is highly random For graphics, pseudo random noise that is repeatable is important –With truly random noise, the texture would change every time the image is rendered or for every scene of an animation

24 Perlin Noise Perlin developed a noise function this is used in many Hollywood movies This noise function has: –No statistical variance when rotated –No statistical variance when translated –A narrow range of values

25 Turbulence Typically the second step in functional textures is to build a turbulence function on top of the noise function The functional textures are then built on top of the turbulence function The turbulence function takes multiple samples of the noise function at many different frequencies Different researchers will frequently develop their own turbulence function

26 Peachy’s Turbulence Function float turb(float x, float y, float z, float minFreq, float maxFreq) { float result = 0.0; for (float freq = minFreq; freq < maxFreq; freq = 2.0*freq) { result += fabs( noise(x*freq, y*freq, z*freq ) / freq ); } return result; }

27 Peachy’s Turbulence Results These samples have frequency ranges of [1.0, 4.0], [1.0, 16.0], and [1.0, 256.0]

28 Perlin’s Turbulence Function float turb(float x, float y, float z, float minFreq, float maxFreq) { float result = 0.0; x = x ; for (float freq = minFreq; freq < maxFreq; freq = 2.0*freq) { result += fabs( noise(x, y, z ) ) / freq; x *= 2.0; y *= 2.0; z *= 2.0; } // return the result adjusted so the mean is 0.0 return result-0.3; }

29 Perlin’s Turbulence Results These samples have frequency ranges of [1.0, 4.0], [1.0, 16.0], and [1.0, 256.0]

30 Marble Texture The Perlin/Ebert marble function uses a turbulence value to determine a color for the location void marble(float x, float y, float z, float color[3]) { float value = x * turb(x, y, z, minFreq, maxFreq); marbleColor( sin(π * value), color ); } There are variations in how the marbleColor function is implemented –Linear interpolation between a light and dark color –Spline based interpolation between a light and dark color

31 Linear Interpolation Marble Examples These samples have frequency ranges of [1.0, 4.0], [1.0, 16.0], and [1.0, 256.0]

32 Spline Interpolation Marble Examples These samples have frequency ranges of [1.0, 4.0], [1.0, 16.0], and [1.0, 256.0]

33 Spline Interpolation Marble Examples These samples have a frequency range of [1.0, 256.0] and have no multiplier and multipliers of 3 and 7

34 Cosine Textures Based on summations of cosine curves Parameters in the equation provide control on result The two dimensional equation is:

35 Cosine Texture Parameters The value of N controls the number of cosine terms –Typically between 4 and 7 The constants Φ Gx Φ Gy are global phase shifts that move the pattern The C i terms change the amplitude of the various cosine components The A 0 terms shift the pattern but are related to the C i terms The ω x1 and ω y1 determine the number of times the pattern repeats The  x i and  y i are phase values that are interdependent with the base periods of x and y

36 Number of Cosines These examples show the results of using 1, 4, and 7 cosines

37 Global Phase Shift These examples with x global phase shifts of 0 and 150 show that the global phase shift moves the pattern

38 Cosine Amplitude Ratio These examples show cosine amplitude ratios of , , and 1.414

39 Cosine Offset These examples show cosine offset values of 0.5, 1.0, and 1.5

40 Base Periods The first example has the same base period (256) for x and y, while the second has an x base period of 256 and a y base period of 512

41 Base Period Ratio These examples have base period ratios of 1.5, 2.0, and 2.5

42 Phase Shift Amplitude These examples have phase shift amplitudes of 0, π/4, π/2, and π

43 Cosine Texture Results A cloud-like texture is possible with 4 cosine components, an x global offset of 200, a cosine amplitude ratio of 0.5, a phase shift amplitude of π/2, a cosine offset of 0.75, an x base period of 655, a y base period of 325, and a base period ratio of 1.7 A bark-like texture is possible with 4 cosine components, a cosine amplitude ratio of 0.707, a cosine offset of 1.0, an x base period of 256, a y base period of 1216, and a base period ratio of 1.7

44 Antialiasing Textures The frequency of an entity and the rate at which it is sampled can cause visible artifacts In this example, it appears that there are multiple textures used Aliasing causes these visible artifacts

45 Aliasing Corrections Aliasing artifacts can be reduced by altering the sampling method Common techniques include –Supersampling –Supersampling with jittering –Inverse mapping Though the techniques are discussed relative to textures, they apply to other antialiasing applications

46 Supersampling Multiple evenly spaced samples are taken from the texture for each location An average or weighted average is taken of these samples to produce the final result One weighted average uses 9 samples and the filter (weighting):

47 Supersampling With Jittering Instead of taking evenly spaced samples, the sample locations are each shifted by a random amount This helps to disturb a regular sampling frequency

48 Supersampling Examples Supersampling Supersampling with jittering

49 Inverse Mapping The area of the pixel is projected back onto the object That object area is projected back into the texture Integrating or averaging the values in this area of the texture gives the final texture result to be used

50 Inverse Mapping Example

51 OpenGL Texture The steps to using texture in OpenGL are: –Create or load the texture into OpenGL –Enable texturing –Specify how the texture is to be used –Specify texture coordinates for polygon vertices or surface corners OpenGL allows the programmer to specify if texture is to be added before or after the specular highlight OpenGL allows textures of varying resolutions to deal with aliasing problems OpenGL also has support for environment mapping

52 Texture Coordinates The texture coordinates influence how the texture is applied Texture coordinates are in the range [0.0, 1.0] If OpenGL is told to repeat the texture, values outside of this range cause multiple copies of the texture to be used If OpenGL is told to clamp the coordinates, any values below the range will be set to 0.0 and any above the range will be set to 1.0

53 Texture Coordinates In the first example, texture coordinates are in the range [0.0, 1.0] In the second example, texture coordinates are in the range [0.0, 0.5]

54 Texture Coordinates By picking appropriate texture coordinates, two adjacent planes can be textured seamlessly

55 Bézier Surface Texturing Bézier surfaces can be textured if points are also supplied for the four corner control points

56 Specular Highlights OpenGL can include the specular component before texturing OpenGL can include the specular component after texturing