Texture Mapping Still Grading…
Total Page:16
File Type:pdf, Size:1020Kb
Logistics Checkpoint 2 Texture Mapping Still grading… Note on grading Checkpoint 3 Due Monday Project Proposals All should have received e-mail feedback. Logistics Projects Grad students Approx 26-28 projects Please send topic of grad report. Listing of projects now on Web Presentation schedule Presentations (15 min max) Last 4 classes (week 9 + week 10 + finals week) Sign up st nd rd Email me with 1 , 2 , 3 choices First come first served. Computer Graphics as Virtual Photography Remember this? real camera photo Photographic Photography: scene (captures processing print light) Bi-directional Reflectance Function processing BRDF = fr ("i ,!i ,"r ,! r ) Computer 3D camera tone synthetic Graphics: models model reproduction image At a given point, gives relative reflected illumination in any (focuses simulated direction with respect to incoming illumination coming from lighting) any direction 1 Illumination Models Phong Model 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. = + • + • ke L(V ) ka La kd ∑i Li (Si N) ks ∑i Li (Ri V) ambient diffuse specular Question Texture Mapping What if Phong (or other) Illumination models aren’t good enough? Developed in 1974 by Ed Catmull, currently president of Pixar Texture Mapping – use an image Procedural Shading – program your own Goal: Make Phong shading less plastic looking Texture Mapping 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 (xo,yo,zo) Screen space (x, y) Watt 2 Texture Mapping Texture Mapping Key to texture mapping is texture space (u,v) parameterization parameterization 3D geometry must be expressed as a function of 2 variables, u and v. object space (xo,yo, zo) Examples: Planar projection Spherical Bi-cubic patch screen space (x,y) Cylindrical Texture pipeline Texture pipeline example Akenine-Moller / Haines Akenine-Moller / Haines Projector function Projector function Converts 3D point in object space Spherical Mapping (x,y,z) to 2D point in texture parameter space (u,v) Examples: Spherical mapping Cylindrical mapping Planar mapping Parametric surface mapping 3 Projector function – Spherical Mapping Projector function Cylindrical mapping Texture is like a rubber sheet stretched to fit model Projector function Projector function Spherical mapping Bi-cubic surfaces Projector function – bicubic surfaces Projector function Texture Mapping Applets http://www.cs.brown.edu/exploratories/ freeSoftware/catalogs/texture_mapping. html Watt 4 Corresponder function Texture Mapping - Direct Mapping 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 – Using a Portion of the Image Texture Mapping – out of range Repeat Mirror clamp border (tile) (tile) Texture mapping Texture mapping Aliasing- point sampling in middle of pixel - need Aliasing more! Sampling – images are discrete, not continuous. Resolution of sampled space (in this case texture map) is not fine enough 5 Texture Mapping Aliasing -because of interpolation and Texture perspective projection Mapping – Aliasing Watt aliased image anti-aliased image Texture Mapping - Anti-aliasing Texture mapping Point sample at higher resolution (sometimes Texture Map Aliasing Applet very difficult) Nearest Pick the closest texel http://www.nbb.cornell.edu/neurobio/la Linear nd/OldStudentProjects/cs490- Take an average of surrounding texels 96to97/anson/TextureMappingApplet/ Mip-Mapping Multiple textures of the same image Use low pass filter before sampling Can sometimes use stochastic sampling to improve results Texture Mapping Mipmapping 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. 6 Texture Mapping Texture pipeline Mipmaps Break 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 Value Transform functions Texture Mapping- Bump Mapping Texel data interpretation: . Adds roughness to surfaces Normal displacement – Bump Mapping . Quick way to add detail to Transparency Mask – Alpha Mapping an object Reflection – Environment Mapping . Polygon remains physically Illumination – Light Mapping flat, but appears bumpy Specular component – Gloss Mapping Lighting intensities – Radiance Mapping Jim Blinn 7 Texture Mapping- Bump Mapping Texture mapping – Bump Mapping Perturbing surface normal Texture map represents displacements from the normal Use perturbed normal in illumination model Bump Mapping Theory Bump Mapping-Theory If your eyes see light and dark bumps Flat surfaces reflect more light Bumpy surfaces reflect less Bump Mapping Texture Mapping Perlin Dnoise example Bump Mapping [Perlin85] Normal += Dnoise (point) 8 Alpha Mapping Texture Mapping- Environment mapping Used to control the transparency. Create an image, representing the reflection of the world onto an object Example: Use surrounding sphere or box, image is texture map indexed by direction of reflection ray Poor-man’s ray tracing - cheaper 3dimpact.com Texture Mapping- Environment 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 Texture Mapping Environment Mapping Environment mapping spherical Cube map 9 Texture mapping Light Mapping Reflection mapping Texture map that describes illumination (light sources)to apply flipcode.com Gloss Mapping Gloss Mapping The texture that controls the specular reflection color. Modulates the the specular reflection and the environment map. ozone3d.net Texture Mapping Texture Mapping – Radiance Maps Static Provides approximated radiance values, Texture map image is taken under a single not simply color info, as a texture. lighting condition Radiance map not only for the distant scene, but in reflections from objects. Q: What happens when lighting conditions Radiance in map used in global of the scene doesn’t match that of your illumination solution texture? Technique used in Fiat Lux A: let’s go to the video tape 10 Texture pipeline Layered Texture Mapping Finally obtained data is applied in illumination equation. Layered Texture Mapping Multipass Texture Rendering Applet Multiple textures for multiple parts of illumination model rendered on multiple http://users.interfriends.net/maurid/B passes. umpMapping.htm Modern hardware supports up to 10 passes on a single frame. Multipass Texture Render Summary Quake III Engine Texturing Pipeline Passes 1-4: accumulating bump map Advantages of texture mapping Pass 5: diffuse lighting Easy way to add complexity to a scene Pass 6: base texture Hardware support Pass 7: Specular Issues: Pass 8: emissive lighting Aliasing Pass 9: volumetric effects Limited resolution (zoom in DOOM effect) Pass 10: screen flashes Static image 11 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? 12.