DOC PREVIEW
CMU CS 15462 - 09-texture

This preview shows page 1-2-3-4-27-28-29-30-56-57-58-59 out of 59 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 59 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Computer Graphics 15-462Texture and other MappingsShadowsTexture MappingBump MappingDisplacement MappingEnvironment MappingShadowsTexture MappingBump MappingDisplacement MappingEnvironment MappingAngel Chapter 7COMPUTER GRAPHICS15-4622Computer Graphics 15-462Announcements• Written assignment #1 back later next week.3Computer Graphics 15-462ShadowsShadows occur where objects are hidden from a light source• Omit any intensity contribution from hidden light sources• Umbra and penumbra (function of size of light source)• Soft shadows and hard shadows (point light source at a distance)• Important perceptual clue for connecting objects to ground (feet in particular)• But object-to-object shadows also important• In general, shadows from many light sources4Computer Graphics 15-462Planar Projection ShadowsSimplest case:Point light source (no penumbra) and shadows only on the ground planeGood for flight simulatorsShadow is projection of polygononto the surface with the center of projection at the light source5Computer Graphics 15-462Planar Projection ShadowsPut light source at origin with Simple perspectiveprojection through theorigin:Translate back with),,(111zyxT−−− =00/100100001000011yM),,(111zyxT6Computer Graphics 15-462Planar Projection Shadows in OpenGLGlFloat m[16]; /* shadow projection matrix */For (i=0;i<15;i++) m[i]=0.0;m[0] = m[5] =m[10] = 1.0; m[7] = -1.0/y1;glBegin(GL_POLYGON);/* draw the polygon normally */glEnd();glMatrixMode(GL_MODELVIEW);glPushMatrix(); /* save state*/glTranslatef(x1,y1,z1); /* translate back */glMultMatrixf(m); /* project*/glTranslate(-x1,-y1,-z1); /* move light to origin */glColor3fv(shadow_color);glBegin(GL_POLYGON);/* draw the polygon again */glEnd();glPopMatrix(); /* restore state */7Computer Graphics 15-462Question• If a perspective transform does a point light source, what does a directional light source?• [Angel demo]8Computer Graphics 15-462Limitations of Planar Projection Shadows• Only do shadows on flat surfaces• Objects must be far enough apart to not cast shadows on each other—although artifacts often hard to detect.• Related approach: projective textures(Blurred drop shadow texture from video game “Halo”)9Computer Graphics 15-462Other Shadow AlgorithmsShadow Maps (Williams, 1978):• Z-Buffer algorithm• Works for curved surfaces1. Render from light source to compute depth map (z distance toclosest object for each pixel in the map).2. While rendering, if a point (x,y,z) is visible, map (x,y,z) in the coordinates of the viewpoint to (x’,y’,z’), the coordinates of the point from the light. 3. If z’ is greater than the value in the z-buffer for that point, then a surface is nearer to the light source than the point under consideration and the point is in shadow. If so, render with a shadow intensity, if not render as normal.• Handles multiple light sources (with multiple z-buffers), moving objects and lights (at the cost of several renderings). Clearly a winning strategy with hardware.10Computer Graphics 15-462Shadow Maps (Williams, 1978)11Computer Graphics 15-462Other Shadow AlgorithmsProjecting polygons—scan line (Appel 1968)Build a data structure that links all polygons where one might shadow the other (depends on polygon location and lighting source location—animation would require recalculating). Multiple data structures for multiple lights.When scan converting have three possibilities• Shadow polygon does not cover generated scan line segment• Shadow polygon completely covers segment (adjust intensity for shadow)• Shadow polygon partially covers segment, subdivide and repeatPoint light sourcePolygon AShadow of A on BPolygon BView pointScanline12Computer Graphics 15-462Other Shadow AlgorithmsShadow Volumes (Crow 1977)Compute the volume of space swept out by an object, intersected with the viewing volume.Include these invisible objects in rendering pipeline.Render visible objects as in shadow if they are in front of a back facing shadow polygon and in back of a front facing polygon. Extend the z buffer to contain this extra information.View volumePoint light sourcePolygonIntersection of shadow volume with view volume13Computer Graphics 15-462Examples: Shadow Volumes14Computer Graphics 15-462Texture Mapping15Computer Graphics 15-462• Real objects have small surface features• One option: use a huge number of polygons with appropriate surface coloring and reflectance characteristics• Another option: use a mapping algorithm to modify the shading algorithm– Texture mapping– Bump mapping– Displacement mapping– Environmental mappingLast time we talked about shading. But uniformly colored or shaded surfaces are unrealistic.16Computer Graphics 15-462The Quest for Visual Realism17Computer Graphics 15-4622D Texture MappingTexture images to make our surfaces more life-likeScan textures from the world (clouds, wood grain) or paint them yourselfStore the texture in a 2D imageMap the image onto the surface by a function which maps (u,v)coordinates of our parametric surface onto (x,y) image coordinatesWhen shading a surface point, we look up the appropriate pixel from the 2D image, and use that to affect the final colorVoila! Your favorite picture painted onto a donut.This technique is called parametric texture mappingBut how to map from texturecoordinates to object coordinates?Easy for a parametric surface,less obvious for other models.18Computer Graphics 15-462Texture Mapping: General()( )( )wvuTvuTuT,,,()ssyx ,()wwwzyx ,,Texture Space Object Space Screen Space19Computer Graphics 15-462Specifying the Mapping FunctionSome objects have natural parameterizations:– Sphere: use spherical coordinates (φ,θ)=(2πu,πv)– Cylinder: use cylindrical coordinates (u,θ)=(u,2πv)20Computer Graphics 15-462Specifying the Mapping FunctionSome objects have natural parameterizations:– Parametric surface (such as B-spline or Bezier): use patch parameters (u,v))()(minmaxminmaxminminminmaxminmaxminminvvttttvvuussssuu−−−+=−−−+=Doesn’t take into account the curvature of the surface: stretching.Just like with roller coaster.21Computer Graphics 15-462Specifying the Mapping FunctionWhat about arbitrary polygonal objects?Two step mapping:• To a canonical shape first• Then project normals from objecta) From texture value to objectb) Use normals to find texturec) Line from center to point to texture value22Computer Graphics 15-462Or design the


View Full Document

CMU CS 15462 - 09-texture

Download 09-texture
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view 09-texture and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view 09-texture 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?