Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter XVI Texturing toward Global Illumination

Similar presentations


Presentation on theme: "Chapter XVI Texturing toward Global Illumination"— Presentation transcript:

1 Chapter XVI Texturing toward Global Illumination

2 Local vs. Global Illuminations
Lighting or illumination models are divided into two categories. Local illumination Global illumination The Phong model is the representative of local illumination models, where the illumination of an object depends solely on the properties of the object and the light sources. Neither (a) nor (b) is correct. The global illumination (GI) model considers the scene objects as potential indirect light sources, producing (c).

3 Ray Tracing The primary ray spawns three secondary rays.
Shadow ray toward the light source Reflection ray Transmitted/refraction ray for a translucent object

4 Ray Tracing (cont’d) An image generated by ray tracing

5 Light Mapping When both the object and the light source are static, the diffuse reflections remain constant over the quad independently of the camera position. Consider the diffuse reflection term, max(n·l,0)sdmd, of the Phong model. We can precompute max(n·l,0)sd which represents the incoming light named the irradiance, and md will be read from an image texture at run time. The pre-computed irradiance is stored in a texture, named the light map.

6 Light Mapping (cont’d)
When the irradiance values are pre-computed, there is no real-time constraint. Therefore, we can use an expensive global illumination model. In most cases, we use the radiosity algorithm presented in Section Consequently, light-mapped scenes show higher quality than the ones locally illuminated. The method for creating a light map is similar to the one for creating a normal map presented in Section The surface to be light-mapped is parameterized and rasterized in a texture. For each sampled surface point corresponding to a texel, irradiance is computed.

7 Environment Mapping A shiny object reflects its surrounding environment. For this, a special texture, named the environment map, is used. It captures the surrounding environment. Shown below is a cube map.

8 Cube Mapping The cube map (illustrated as a box) surrounds an object. A ray fired from the viewpoint is traced to determine the color reflected at p. Environment mapping is often called a simplified ray tracing in the sense that only the one-bounce reflection vector, R, is traced. It is just a small step out of local illumination. For example, a concave object does not reflect itself.

9 Cube Mapping (cont’d) Cube map creation
As usual, glGenTextures and glBindTexture are invoked. Each face of the cube map is named after the axis pointing toward that face. The symbolic constants for the faces are defined by adding one in succession.

10 Cube Mapping (cont’d) Vertex shader

11 Cube Mapping (cont’d) Fragment shader

12 Ambient Occlusion In the Phong lighting model, the ambient term, sama, accounts for indirect lighting. It assumes that the ambient light randomly bounces in the scene and arrives at a surface point from all directions. In reality, however, some of the directions may be occluded. The ambient occlusion algorithm estimates how much of the ambient light is occluded, which we call the occlusion degree. In order to compute the occlusion degree, a hemisphere could be used. It is evenly sampled and then rays are cast from a surface point toward the sampled points.

13 Ambient Occlusion (cont’d)
Unfortunately, ray casting is expensive. An alternative is to partition the hemisphere into ‘occupied’ and ‘empty’ spaces. The occlusion degree may be approximated as the ratio between the occupied space and the entire hemisphere space.

14 Ambient Occlusion (cont’d)
Measuring the ratio is again approximated by using a set of sample points distributed within the hemisphere. Computing the ratio is approximated by the depth test using the depth map and the points sampled in the hemisphere. This is similar to the depth comparison performed in shadow mapping.

15 Ambient Occlusion (cont’d)
Examples

16 Ambient Occlusion (cont’d)
A problem Nonetheless, such artifacts are rarely perceived by the average users, and ambient occlusion is widely accepted in games.


Download ppt "Chapter XVI Texturing toward Global Illumination"

Similar presentations


Ads by Google