2D Texture Mapping vs. Solid Texture2D texture mapping3D texture mapping:Solid textureDCP4516 Introduction to Computer Graphics 6

3D Texture Mapping•Almost the same as 2Dtexture mapping–Texture is a “block”whichobjects fit into–Texture coordinates are 3Dcoordinates which equalsome value inside the textureblock•The most interesting solidtextures are random ones–a great marble algorithm hasnow become clichéDCP4516 Introduction to Computer Graphics 7An Image Synthesizerby Ken Perlin, SIGGRAPH '85

Making Solid Noise•White noise–Calling a random number atevery 3D point–Too random•How about blur a white noise?–No practical implementation•Interpolating random numbersat lattice points–Better, but lattice is too obviousDCP4516 Introduction to Computer Graphics 8

Perlin Noise: Basic Idea•Create randomly oriented unit vectors(gradients) on 3D grid points•Compute dot of a random orient vectorand an fractional value vector(x, y, z)–This moves local maxima and minima off thegrid points•Use Hermite interpolation to generate anoise valueijkn(x,y,z)x1 y1 z1ixjyDCP4516 Introduction to Computer Graphics 9k zijk( xi,y j,zk)( x', y', z') W( x') W ( y') W ( z')( (x', y', z'))ijk(x, y, z)(x+1, y, z)

Perlin Noise: Strength•Avoids mach bands by using Hermite interpolationijk( x', y', z') W( x') W ( y') W ( z')( (x', y', z'))•Reduces memory by permuting the index of an 1D arrayof random vectors: unit length, each component (-1,1)•Moves local maxima and minima off the grid points byusing dot of random vector and fractional value vectorijk G( (i ( j ( k)))ijkW ( t)2t33t21DCP4516 Introduction to Computer Graphics 10

Perlin Turbulence•Many natural textures contain a variety offeature sizes in the same texture•Pseudofractal functionturbulence(x,y,z)in(•Repeatedly adds scaled copies of the noiseon top of itselffix,ffiiy,fiz)f 2iiDCP4516 Introduction to Computer Graphics 11

Turbulence Texture Example•Results of summing 1 to 8 termsDCP4516 Introduction to Computer Graphics 12

ComparisonNoiseTurbulenceDCP4516 Introduction to Computer Graphics 13

Perlin Noise ResultsNoiseNoise bump mappedDCP4516 Introduction to Computer Graphics 14

More on Perlin Noise•Easy to read intro•Technical paper on 3D implementation•Perlin, “Improving Noise”, SIGGRAPH’02–Add 2nd order continuity–Better distribution of orient vectorsDCP4516 Introduction to Computer Graphics 16

Beyond Noise: Procedural TextureReaction-DiffusionGreg Turk, Siggraph ‘91DCP4516 Introduction to Computer Graphics 17

Procedural Texture ExampleImages from Texturing and Modeling: AProcedural Approach By Ebert, Musgrave,Peachey, Perlin, and WorleyDCP4516 Introduction to Computer Graphics 18

Procedural Texture ExampleImages from Texturing and Modeling: A Procedural ApproachBy Ebert, Musgrave, Peachey, Perlin, and WorleyDCP4516 Introduction to Computer Graphics 19

ShadowsShadows occur where objects arehidden from a light source•Omit any intensity contributionfrom hidden light sources•Umbra and penumbra (functionof size of light source)•Soft shadows and hard shadows(point light source at a distance)DCP4516 Introduction to Computer Graphics 20

Shadows (cont.)•Important perceptual clue for connecting objectsto ground (feet in particular)•But object-to-object shadows also important•In general, shadows from many light sourcesDCP4516 Introduction to Computer Graphics 21

Planar Projection ShadowsSimplest case:•Point light source–no penumbra–shadows only on the ground plane•Good for flight simulatorsShadow is projection ofpolygon onto the surface withthe center of projection at thelight sourceDCP4516 Introduction to Computer Graphics 22

Limitations of Planar Projection Shadows•Only do shadows on flat surfaces•Objects must be far apart enough to not castshadows on each other—although artifactsoften hard to detect•Related approach:projective textures(Blurred drop shadow texturefrom video game “Halo”)DCP4516 Introduction to Computer Graphics 23

Shadow Maps (Williams, 1978)•Basic observation–If light cannot see an object, it is in shadow•Z-Buffer algorithm–Depth map fromthe view of light source•Work on curvedsurfaceDCP4516 Introduction to Computer Graphics 24

Shadow Maps—Algorithm•Render from light source to compute depth map (zdistance to closest object for each pixel in the map).•While rendering, if a point (x,y,z) is visible, map (x,y,z) inthe coordinates of the viewpoint to (x’,y’,z’), thecoordinates of the point from the light.•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 pointunder 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 severalrenderings). Clearly a winning strategy with hardware.DCP4516 Introduction to Computer Graphics 25

Shadow MapsDCP4516 Introduction to Computer Graphics 26

Pros of Shadow Maps•No knowledge or processing of the scenegeometry is required–shadow mapping is an image space technique,working automatically with objects created oraltered on the GPU.•Only a single texture is required to holdshadowing information for each lightDCP4516 Introduction to Computer Graphics 28

Cons of Shadow Maps•Aliasing, especially when using small shadow maps•Objects outside or crossing the near and far clip planesare not properly accounted for by shadowing•Requires extra shadow map rendering pass and textureloadingDCP4516 Introduction to Computer Graphics 29

More on Shadow Maps•Lance Williams, “Casting Curved Shadows onCurved Surfaces,”SIGGRAPH 78•William Reeves, David Salesin, and Robert Cook(Pixar), “Rendering antialiased shadows withdepth maps,”SIGGRAPH 87•Mark Segal, et. al. (SGI), “Fast Shadows andLighting Effects Using Texture Mapping,”SIGGRAPH 92•Tutorial by Cass Everitt Introduction to Computer Graphics 30

More magazines by this user
Similar magazines