Texture Mapping Logistics  Checkpoint 2  Mostly graded.  Note on grading -- Regaining points  Checkpoint 3  Due Monday  Project Proposals  All should have received e-mail feedback. 1
Logistics  Checkpoint 2  Another means for finding equation of a plane  Using determinants.  See: http://local.wasp.uwa.edu.au/~pbourke/geometry/planeeq/ Logistics  Grad students  Please send topic of grad report. 2
Projects  Proposals  Proposal due before break (please get yours in if not submitted)  Feedback on proposals -- mycourses  Web sites please.  23 projects (4-5 more expected) Projects  Presentations:  Dates:  Week 9: Wed, Feb 13 (sorry Radiosity)  Week 10: Mon, Feb 18  Week 10: Wed, Feb 20  Finals Week / Week 11: Mon, Feb 25  15 minutes / presentation  Schedule on Web by next class  Please send me choice of time/day 3
Computer Graphics as Virtual Photography real camera photo Photographic Photography: scene (captures processing print light) processing camera Computer 3D synthetic tone model Graphics: models image reproduction (focuses simulated lighting) Remember this?  Bi-directional Reflectance Function BRDF f ( , , , ) = � � � � r i i r r At a given point, gives relative reflected illumination in any direction with respect to incoming illumination coming from any direction 4
Illumination Models  Illumination model - function or algorithm used to describe the reflective characteristics of a given surface.  More accurately, function or algorithm used to approximate the BRDF. Phong Model ∑ ∑ k L ( V ) = k L + k L ( S • N) + k L ( R • V) e a a d i i s i i i i ambient diffuse specular 5
Question  What if Phong (or other) Illumination models aren’t good enough?  Texture Mapping – use an image  Procedural Shading – program your own Texture Mapping  Developed in 1974 by Ed Catmull, currently president of Pixar  Goal: Make Phong shading less plastic looking 6
Texture Mapping  A means to define surface characteristics of an object using an image  Mapping a 2D image onto a 3D surface  Coordinate spaces in texture mapping  Texture space (u, v)  Object space (x o ,y o ,z o )  Screen space (x, y) Texture Mapping Watt 7
Texture Mapping  Key to texture mapping is parameterization  3D geometry must be expressed as a function of 2 variables, u and v.  Examples:  Planar  Spherical  Bi-cubic patch  Cylindrical Texture Mapping texture space (u,v) parameterization object space (x o ,y o , z o ) projection screen space (x,y) 8
Texture pipeline Akenine-Moller / Haines Texture pipeline example Akenine-Moller / Haines 9
Projector function  Converts 3D point in object space (x,y,z) to 2D point in texture parameter space (u,v)  Examples:  Spherical mapping  Cylindrical mapping  Planar mapping  Parametric surface mapping Projector function  Spherical Mapping 10
Projector function – Spherical Mapping Texture is like a rubber sheet stretched to fit model Projector function  Cylindrical mapping 11
Projector function  Spherical mapping Projector function  Bi-cubic surfaces 12
Projector function – bicubic surfaces Watt Projector function  Texture Mapping Applets http://www.cs.brown.edu/exploratories/ freeSoftware/catalogs/texture_mapping. html 13
Corresponder function  Converts from texture parameter space (u, v) to texel space.  Controls the way an image is applied  Examples:  Direct mapping  Use a portion of an image  Apply transforms  Out of range transforms Texture Mapping - Direct Mapping 14
Texture Mapping – Using a Portion of the Image Texture Mapping – out of range Mirror clamp border Repeat (tile) (tile) 15
Texture mapping  Aliasing  Sampling – images are discrete, not continuous.  Resolution of sampled space (in this case texture map) is not fine enough Texture mapping  Aliasing- point sampling in middle of pixel - need more! 16
Texture Mapping – Aliasing Watt Texture Mapping  Aliasing -because of interpolation and perspective projection aliased image anti-aliased image 17
Texture Mapping - Anti-aliasing  Point sample at higher resolution (sometimes very difficult)  Nearest  Pick the closest texel  Linear  Take an average of surrounding texels  Mip-Mapping  Multiple textures of the same image  Use low pass filter before sampling  Can sometimes use stochastic sampling to improve results Texture mapping  Texture Map Aliasing Applet http://www.nbb.cornell.edu/neurobio/la nd/OldStudentProjects/cs490- 96to97/anson/TextureMappingApplet/ 18
Texture Mapping  Mipmaps  Pre-calculate your texture map at many resolutions (or layers)  Store all “texture layers” in a single image.  Use “appropriate” layer when performing rendering, interpolating between levels as required  Mip == “multum in parvo”  Latin for “many things in a small space”  Native support in hardware. Mipmapping 19
Texture Mapping  Mipmaps Texture pipeline  Break 20
When we last left our hero Value transform function  Texture maps need not be just plain old RGB.  Texture == data associated with an object  Stored in a 2D array of texels  Value transform function  Transforms data into value usable by the illumination model at the shading point 21
Value Transform functions  Texel data interpretation:  Normal displacement – Bump Mapping  Transparency Mask – Alpha Mapping  Reflection – Environment Mapping  Illumination – Light Mapping  Specular component – Gloss Mapping  Lighting intensities – Radiance Mapping Texture Mapping- Bump Mapping  Adds roughness to surfaces  Quick way to add detail to an object  Polygon remains physically flat, but appears bumpy Jim Blinn 22
Texture Mapping- Bump Mapping  Perturbing surface normal  Texture map represents displacements from the normal  Use perturbed normal in illumination model Texture mapping – Bump Mapping 23
Bump Mapping Theory  If your eyes see light and dark  bumps  Flat surfaces reflect more light  Bumpy surfaces reflect less Bump Mapping-Theory 24
Bump Mapping  Perlin Dnoise example [Perlin85] Normal += Dnoise (point) Texture Mapping  Bump Mapping 25
Alpha Mapping  Used to control the transparency.  Example: 3dimpact.com Texture Mapping- Environment mapping  Create an image, representing the reflection of the world onto an object  Use surrounding sphere or box, image is texture map indexed by direction of reflection ray  Poor-man’s ray tracing - cheaper 26
Texture Mapping- Environment mapping  Not associated with a particular object but with an imaginary surface surrounding the scene  Specular Reflection – indexed by reflected ray  Diffuse - by surface normal  Transparency – refracted ray direction Environment Mapping 27
Environment Mapping spherical Cube map Texture Mapping  Environment mapping 28
Texture mapping Reflection mapping Light Mapping  Texture map that describes illumination (light sources)to apply flipcode.com 29
Gloss Mapping  The texture that controls the specular reflection color.  Modulates the the specular reflection and the environment map. Gloss Mapping ozone3d.net 30
Texture Mapping  Static  Texture map image is taken under a single lighting condition  Q: What happens when lighting conditions of the scene doesn’t match that of your texture?  A: let’s go to the video tape Texture Mapping – Radiance Maps  Provides approximated radiance values, not simply color info, as a texture.  Radiance map not only for the distant scene, but in reflections from objects.  Radiance in map used in global illumination solution  Technique used in Fiat Lux 31
Texture pipeline  Finally obtained data is applied in illumination equation. Layered Texture Mapping 32
Layered Texture Mapping  Applet http://www.neilwallis.com/java/bump 1.htm Multipass Texture Rendering  Multiple textures for multiple parts of illumination model rendered on multiple passes.  Modern hardware supports up to 10 passes on a single frame. 33
Multipass Texture Render  Quake III Engine  Passes 1-4: accumulating bump map  Pass 5: diffuse lighting  Pass 6: base texture  Pass 7: Specular  Pass 8: emissive lighting  Pass 9: volumetric effects  Pass 10: screen flashes Summary  Texturing Pipeline  Advantages of texture mapping  Easy way to add complexity to a scene  Hardware support  Issues:  Aliasing  Limited resolution (zoom in DOOM effect)  Static image 34
Summary  In this lecture, we assumed that textures were pre-generated and saved in a file  Textures can also be generated on the fly using a function or procedure…  But that’s for next time…  Questions? 35
Recommend
More recommend