DOC PREVIEW
UCSD CSE 167 - Shadows & Ray Tracing

This preview shows page 1-2-3-4-30-31-32-33-34-61-62-63-64 out of 64 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 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 64 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 64 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

#13: Shadows & Ray TracingCSE167: Computer GraphicsInstructor: Ronen BarzelUCSD, Winter 20061Outline for todayFancy Texture Effects Shadow Mapping Ray Tracing2Where are we now Texture mapping Assign texture coordinates to vertices• based on surface parameters• based on projection in object or world space Interpolate texture coordinates to pixels• look up color in texture file• to avoid magnification problems, use bilinear or bicubic filtering• to avoid minification problems, use mipmaps• precomputed hierarchy of scaled-down versions of the texture image• based on amount of minification, choose two nearest mipmaps• look up color in each, interpolate between them (trilinear interpolation) Procedural textures compute patterns in procedural shader routines choose details based on screen-space size of surface area used especially for wood, marble, cloth, …3Fancy Texture Effects We can look up data at each pixel…What can we do with it? Given procedural shaders, can do most anything we want! Here are some common techniques Often supported by renderer without procedural shading Some supported directly by hardware4Bump Mapping An easy way to make a smooth surface bumpy Use a texture to represent the variation in surface height With Phong interpolation we have a normal for each pixel Use the texture value to perturb the normal Then use the perturbed normal for the per-pixel lighting Texture can be stored or procedural Used for rough surfaces Used for “embossing” Modern hardware supports bump mapping Limitation: bumps are fake silhouette edges betray smoothness5Bump mapping6Displacement Mapping Like bump mapping but instead of faking by perturbing normals… …actually move the surface point Gives proper silhouettes, Gives self-occlusion Gives self-shadowing (once we have shadows…) Expensive and hard to do well Supported by some software renderers Supported by some recent hardware7Displacement Mapping8Environment Mapping A simple but technique to fake mirror-like reflections of an environment Precompute, photograph, or paint an environment map: A view of the distant environment (ground, sky, horizon, etc.) from the center of the scene Can be stored in a single spherically-projected texture Can be stored in 6 faces of a cube Imagine that the scene is enclosed in a huge sphere or cube, textured with that map For each vertex or point to be shaded: compute the vector e from the point to the eye compute the reflection vector R find out where R intersects the environment cube/sphere, and use that texture coordinate• (because the environment is huge, we don’t need to take into acount the position of the point) add the texture color to the point’s color, with some constant ke9Environment Mappingen r For a spherical environment with polar mapping:R = 2!e !!n( )!n "!es =atan2 Rz, Rx( )+#2#t =asin Ry( )+#2#10Environment Mapping11Environment Mapping(www.sparse.org)12Reflection Mapping Environment mapping often called Reflection Mapping Generally, environment maps: only reflect distant environment, not nearby objects are static: don’t incorporate things that animate But you can get animated local reflections… If you’re willing to take two steps13Reflection Mapping For Woody reflected in Buzz’s helmet…14Reflection Mapping First, render just Woody, using camera at Buzz’s head15Reflection Mapping In main render, Buzz’s helmet procedural shader computes reflection If reflection hitsWoody texture mapuse its color, otherwiseuse the regular environment map Two renders to generate each frame! In practice, many renders to render each frame16Other Texture Effects Textures can be used to map most any property onto a surface Not just color Bump or displacement Diffuse coefficient? Specular Coefficient? “combing” directions for anisotropic reflectivity Parameters to procedural patterns Many texture maps can be used at once Different layers of effect e.g. Base color, then smudges, scratches, dents, rust, etc.• each might affect color, bumps, displacment, lighting, reflectivity, … Hardware systems have limited amounts of texture memory In production, it’s not uncommon to have a dozen or more textures on each surface Texture maps can themselves be computed or animated E.g. To show a TV picture in an animation:• each frame, use a different texture map on the TV E.g. For raindrops dripping down a window E.g. To simulate effects such as patina and aging17Multipass rendering Render diffuse, specular, reflection, etc. separately Combine them using an image manipulation program Lets you effectively tweak kd, ks, etc. without re-rendering+18Outline for today Fancy Texture EffectsShadow Mapping Ray Tracing Intro19Shadows So far we included contribution of all lights in illumination But sometimes a surface is in shadow: Another object is between the surface and a light source That light source shouldn’t contribute to the surface’s illumination20Shadows How can we test for this when rasterizing/shading? Processing triangles one at a time No information about other objects Trick: introduce shadow maps (or shadowmaps) Precompute where shadows are for a given light Before adding contribution of a light, check against shadow map Here’s how it works…21Shadow Map Render an image from the light’s point of view Camera look-from point is the light position Aim camera to look at objects in scene Render only the z-buffer depth values• Don’t need colors• Don’t need to compute lighting or shading• (unless a procedural shader would make an object transparent) Store result in a Shadowmap AKA depth map Store the depth values Also store the (inverse) camera & projection transform Remember, z-buffer pixel holds depth of closest object to the camera A shadowmap pixel contains the distance of the closest object to the light22Shadow Map Point light source23Shadow Map Directional light source use orthographic shadow camera24Shadow Mapping When lighting a point on a surface For each light that has a shadowmap… Transform the point to the shadowmap’s image space• Get X,Y,Z values• Compare Z to the depth value at X,Y in the shadowmap• If the shadowmap


View Full Document

UCSD CSE 167 - Shadows & Ray Tracing

Documents in this Course
Lighting

Lighting

38 pages

Review

Review

59 pages

Surfaces

Surfaces

22 pages

Review

Review

110 pages

Midterm

Midterm

4 pages

Lighting

Lighting

38 pages

Lighting

Lighting

71 pages

Review

Review

110 pages

Lighting

Lighting

71 pages

Load more
Download Shadows & Ray Tracing
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 Shadows & Ray Tracing 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 Shadows & Ray Tracing 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?