Presentation is loading. Please wait.

Presentation is loading. Please wait.

09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping.

Similar presentations


Presentation on theme: "09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping."— Presentation transcript:

1 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping

2 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Today More environment mapping Light Maps

3 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Environment Mapping Environment mapping produces reflections on shiny objects Texture is transferred in the direction of the reflected ray from the environment map onto the object –Uses ray with same direction but starting at the object center Map contains a view of the world as seen from the center of the object Object Viewer Reflected ray Environment Map Lookup ray

4 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Lat/Long Mapping The original algorithm (1976) placed the map on a sphere centered on the object Mapping functions assume that s,t texture coordinates equate to latitude and longitude on the sphere: What is bad about this method? –Sampling –Map generation –Complex texture coordinate computations

5 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Sphere Mapping Again the map lives on a sphere, but now the coordinate mapping is simplified To generate the map: –Take a map point (s,t), cast a ray onto a sphere in the -Z direction, and record what is reflected –Equivalent to photographing a reflective sphere with an orthographic camera (long lens, big distance) Again, makes the method suitable for film special effects

6 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin A Sphere Map

7 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Indexing Sphere Maps Given the reflection vector: Implemented in hardware Problems: –Highly non-uniform sampling –Highly non-linear mapping

8 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Non-uniform Sampling

9 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Non-linear Mapping Linear interpolation of per-vertex texture coordinates picks up the wrong texture pixels –Use small polygons! CorrectLinear

10 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Example

11 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Parabolic Mapping Assume the map resides on a parabolic surface –Two surfaces, facing each other Improves on sphere maps: –Texture coordinate generation is a near linear process –Sampling is more uniform –Result is more view-independent However, requires multi-passes to implement, so not generally used

12 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Other Env. Map Tricks Partially reflective objects –First stage applied color texture –Second stage does environment mapping using alpha blend with existing color Just put the lights in the environment map –What does this simulate? Recursive reflections Bad cases for environment maps?

13 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Light Maps Speed up lighting calculations by pre-computing lighting and storing it in maps –Allows complex illumination models to be used in generating the map (eg shadows, radiosity) –Used in complex rendering algorithms (Radiance), not just games Issues: –How is the mapping determined? –How are the maps generated? –How are they applied at run-time?

14 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Example

15 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Choosing a Mapping Problem: In a preprocessing phase, points on polygons must be associated with points in maps One solution: –Find groups of polygons that are “near” co-planar and do not overlap when projected onto a plane Result is a mapping from polygons to planes –Combine sections of the chosen planes into larger maps –Store texture coordinates at polygon vertices Lighting tends to change quite slowly (except when?), so the map resolution can be poor

16 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Generating the Map Problem: What value should go in each pixel of the light map? Solution: –Map texture pixels back into world space (using the inverse of the texture mapping) –Take the illumination of the polygon and put it in the pixel Advantages of this approach: –Choosing “good” planes means that texture pixels map to roughly square pieces of polygon - good sampling –Not too many maps are required, and not much memory is wasted

17 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Example Nearest interpolationLinear interpolation What type of lighting (diffuse, specular, reflections) can the map store?

18 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Example No light mapsWith light maps

19 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Applying Light Maps Use multi-texturing hardware –First stage: Apply color texture map –Second stage: Modulate with light map Actually, make points darker with light map DirectX allows you to make points brighter with texture Pre-lighting textures: –Apply the light map to the texture maps as a pre-process –Why is this less appealing? Multi-stage rendering: –Same effect as multi-texturing, but modulating in the frame buffer

20 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Dynamic Light Maps Light maps are a preprocessing step, so they can only capture static lighting Texture transformations allow some effects What is required to recompute a light map at run-time? How might we make this tractable? –Spatial subdivision algorithms allow us to identify nearby objects, which helps with this process Compute a separate, dynamic light map at runtime using same mapping as static light map Add additional texture pass to apply the dynamic map

21 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Fog Maps Dynamic modification of light-maps Put fog objects into the scene Compute where they intersect with geometry and paint the fog density into a dynamic light map –Use same mapping as static light map uses Apply the fog map as with a light map –Extra texture stage

22 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Fog Map Example

23 09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Todo Confirm group names and meeting times –Email cs679-1@cs.wisc.educs679-1@cs.wisc.edu By Monday, Sept 15: Goals for stage 1 By Monday, Sept 22: Lock in Stage 1


Download ppt "09/11/03CS679 - Fall 2003 - Copyright Univ. of Wisconsin Last Time Graphics Pipeline Texturing Overview Cubic Environment Mapping."

Similar presentations


Ads by Google