I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 1/35 CIS 736 Computer Graphics Lecture 17 of 42 Illumination.

Slides:



Advertisements
Similar presentations
1GR2-00 GR2 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
Advertisements

9.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 9 Adding Realism Through Texture.
Lecture 8 Transparency, Mirroring
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Exploration of bump, parallax, relief and displacement mapping
03/16/2009Dinesh Manocha, COMP770 Texturing Surface’s texture: its look & feel Graphics: a process that takes a surface and modifies its appearance using.
Cs123 INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Andries van Dam Texture Mapping Beautification of Surfaces 1/23.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
3D Graphics Rendering and Terrain Modeling
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Computer Graphics Bing-Yu Chen National Taiwan University.
Texture Visual detail without geometry. Texture Mapping desire for heightened realism.
Computer Graphics Inf4/MSc Computer Graphics Lecture 13 Illumination I – Local Models.
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 6, 2014 TEXTURE MAPPING TEXTURES BUMP MAPPING ENVIRONMENT MAPPING PROCEDURAL TEXTURING.
Week 9 - Wednesday.  What did we talk about last time?  Fresnel reflection  Snell's Law  Microgeometry effects  Implementing BRDFs  Image based.
Computer Graphics - Class 10
Computer Graphics (Fall 2005) COMS 4160, Lecture 16: Illumination and Shading 1
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 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.
University of New Mexico
Computer Graphics Inf4/MSc Computer Graphics Lecture 11 Texture Mapping.
Computer Graphics Shadows
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
Erdem Alpay Ala Nawaiseh. Why Shadows? Real world has shadows More control of the game’s feel  dramatic effects  spooky effects Without shadows the.
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 Inf4/MSc Computer Graphics Lecture 7 Texture Mapping, Bump-mapping, Transparency.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
ECSE 4750: Computer Graphics Rensselaer Polytechnic Institute Nov 5, 2012 Texture and Texture Mapping.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
09/11/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.
CS 638, Fall 2001 Today Project Stage 0.5 Environment mapping Light Mapping.
CS 445 / 645: Introductory Computer Graphics Light.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 1/35 CIS 736 Computer Graphics Illumination and Shading.
CS-378: Game Technology Lecture #4: Texture and Other Maps Prof. Okan Arikan University of Texas, Austin V Lecture #4: Texture and Other Maps.
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.
Game Programming 06 The Rendering Engine
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 1/35 CIS 736 Computer Graphics Illumination and Shading.
Computing & Information Sciences Kansas State University Lecture 10 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS559: Computer Graphics Lecture 27: Texture Mapping Li Zhang Spring 2008 Many slides from Ravi Ramamoorthi, Columbia Univ, Greg Humphreys, UVA and Rosalee.
Lecture 6 Rasterisation, Antialiasing, Texture Mapping,
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Ray Tracing Fall, Introduction Simple idea  Forward Mapping  Natural phenomenon infinite number of rays from light source to object to viewer.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
11/24/ :45 Graphics II Shadow Maps Reflections Session 5.
MIT EECS 6.837, Durand and Cutler Texture Mapping & Other Fun Stuff.
Real-Time Dynamic Shadow Algorithms Evan Closson CSE 528.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S CIS 636/736 Computer GraphicsWed 06 Feb 20087/42 CIS 636/736 Computer Graphics Lecture 7 of.
Computer Graphics (Fall 2006) COMS 4160, Lecture 16: Illumination and Shading 1

- Introduction - Graphics Pipeline
University of New Mexico
Buffers and texture mapping
Texture Mapping.
Computer Graphics Texture Mapping
Week 7 - Monday CS361.
ATCM 3310 Procedural Animation
3D Graphics Rendering PPT By Ricardo Veguilla.
So Far We have assumed that we know: The point The surface normal
CS-378: Game Technology Lecture #4: Texture and Other Maps
Texture Mapping Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 1/35 CIS 736 Computer Graphics Lecture 17 of 42 Illumination and Shading 3 of 3: Surface Detail: Texture and Environment Mapping Wednesday, 22 February 2006 Reading: Chapter 15 Adapted with Permission W. H. Hsu

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 22/35 Mapping Circles (1/2) Texture mapping cylinders and cones Imagine a standard cylinder or cone as a stack of circles –use pos. of point on circular perimeter to determine u –use height of point in stack to determine v –map top and bottom caps separately, as onto a plane The easy part: calculating v –height of point in object space, which ranges between [-.5,.5], gets mapped to v range of [0, 1] Calculating u: map points on circular perimeter to u values between 0 and 1; 0 radians is 0,  radians is 1 Then u =  /  These mappings are arbitrary: any function that maps the angle around the cylinder   ) into the range 0 to 1 will work –let’s look at a mapping that follows the “law of least astonishment”

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 23/35 Texture Mapping Cylinders (2/2) Mapping a circle Convert a point P on the perimeter to an angle: Circle radius is not necessarily unit length –we need to use arctangent rather than sine or cosine (arctangent only considers the ratio of lengths) of Pz /Px Use standard function atan2 because it yields the entire circle (values ranging from  to , whereas atan only returns a half circle) –going around the circle in the direction the image would be mapped, atan2 returns angles that range from 0 to  , then abruptly changes to    and returns to 0

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 24/35 Texture Mapping Spheres Imagine a sphere as a stack of circles of varying radii P is a point on the surface of the unit sphere Defining v –calculate u as for the cylinder (use same mapping for cone as well) Defining u –if v=0 or 1, there is a singularity and u should equal some specific value (i.e., u = 0.5) –never really code around these cases because rarely see these values within floating point precision r

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 25/35 Texture Mapping Complex Geometries (1/5) How do I texture-map my Möbius strip? Texture mapping of simple geometrical primitives was easy. How do I texture map more complicated shapes? Let’s say we have a relatively “simple” complex shape: a house How should we texture map it? We could texture map polygon by polygon onto the faces of the house (we know how to do this already, as they are planar). However, this causes discontinuities at edges of polygons. We want smooth mapping without edge discontinuities Intuitive approach: reduce to a previously solved problem. Let’s pretend the house is a sphere for texture-mapping purposes

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 26/35 Complex Geometries (2/5) Texture mapping a house with a sphere Intuitive approach: place bounding sphere around complicated shape Texture mapping has two stages: finding the ray’s object-space intersection point, and converting it into uv-coordinates. Simplify by finding intersection with sphere instead of with house. Then can easily convert into uv-coords But sphere intersection calculation is extra effort. If we’re at the texture-mapping stage, that means we’ve already found the intersection point with the complicated shape! Non-intuitive approach: we can treat point on the complicated object as a point on a sphere, and project using spherical uv-mapping

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 27/35 Complex Geometries (3/5) First, calculate object-space intersection point with geometrical object (house), intersecting against each face Then, use object-space intersection point to calculate uv-coords of sphere at that point using spherical projection Note that a sphere has constant radius, whereas our house doesn’t. Distance from the center of the house to the intersection point (radius) changes with the point’s location

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 28/35 How do we decide what radius to use for the sphere in our uv-mapper? Intersections with our house happen at different radii Answer: spherical mapping of (x,y,z) to (u,v) presented above was a function of radius, does not assume that the sphere has unit radius Always use a sphere with its center at the house’s center, and with a radius equal to the distance from the center to the current intersection point Complex Geometries (4/5)

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 29/35 Complex Geometry (5/5) Choosing appropriate functions We have chosen to use a spherical uv-mapper to simplify texture mapping. However, any mapping technique may be used Each type of uv-projection has its own drawbacks –spherical: warping at poles of sphere –cylindrical: discontinuities at edges of caps –planar: y-component of point ignored for uv-mapping Swapping uv-projection techniques allows drawbacks of one technique to be traded for another. Deciding which drawbacks are preferable depends on the user’s wishes

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 30/35 Texture Mapping in Real-Time (how they do it in Quake III) Interpolating Texture Coordinates Real-time interactive applications cannot afford complex model geometry, so texture mapping provides a “good-enough” solution Precalculate texture coordinates for each facet’s vertices during tessellation - store them with vertices Interpolate uv coordinates linearly across triangles as part of Gouraud shading texture coordinates on each face

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 31/35 Shadow Hacks Geometry Takes Time Projective Shadows Use an orthographic or perspective matrix as the modelview transform to render the projected object (the shadow caster) against another object. Very difficult to shadow anything but a plane What color do you use? Shadow Maps Transform your eye to a light source Render the scene, updating the depth buffer Read the depth buffer into a texture Apply this texture projectively Major aliasing problems

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 32/35 Surface Detail—Bump Mapping Texture mapping a picture of a rough surface onto an object doesn’t look right - the illumination is all wrong Blinn’s hack: use an array of values to perturb surface normals (calculate gradient across values and add it to the normal) Evaluate illumination equation with perturbed normals Effect is convincing across surface, but silhouette edges still appear unperturbed Consider an orange:

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 33/35 Surface Detail Other Approaches Texture maps for actual surface displacement (must do before visible-surface processing). This is quite a bit more complicated than bump mapping or transparency mapping. In Pixar’s Renderman, texture maps are used for actual surface displacement 3D mapping can be used to determine properties as a function of three dimensions: wood, marble, sciviz data, etc.

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 34/35 More Surface Detail -- Bump Mapping Example The tin foil on this Hershey’s Kiss seems a bit too smooth…

I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam October 30, 2003 Shading 35/35 More Surface Detail -- Bump Mapping Example Bump Mapping to the Rescue – Tin foil with no increase in model complexity!