10 - Texture and Enviroment Mapping Flashcards
Texture Mapping
mapping a two-dimensional texture image onto the surface of a three-dimensional object.
Texel
pixels in a texture image called
Types of texture object mapping
Pelting
Atlas (divide it into fragments like countries and texture map each fragment) faster
Pelting
“unwrapping” the texture and flattening it out. This was the traditional approach to texture mapping, but it is largely computationally inefficient and may cause distortions in the image
Atlas mapping
considers the mesh as a series of patches, to which individual bits of texture can be applied.
As the curvature across the object is largely reduced compared to pelting, the end result has fewer distortions and may be computationally more efficient.
Forward Mapping
Texture space is mapped to the object via surface parameterisation, and then projected onto the object in screen space.
texture to screen.
Inverse mapping
First takes a pixel in screen space, and performs and finds the ‘pre-image’ of the pixel, which can then have its texture applied (i.e. it finds which texel the pixel corresponds to).
This method is used much more in practice, especially as it is particularly effective in rendering on-the-fly.
Why is mapping from texture space to screen space non-linear?
A single pixel’s pre-image may be several texels
One texel lies entirely within a screen pixel etc
Pros for forward and inverse mapping
Forward:
Simple to comprehend
Inverse:
suited to scan-line algorithms
Efficient (only required textures are computed)
Sampling From Textures – Backwards Mapping
Mapping from the texture to the screen is non-linear, and there is often a mismatch between resolutions
If the pre-image of a pixel covers several texels then the texture should be supersampled
If the pre-image of a pixel lies within a texel low pass filtering is required
Environment Mapping
(Not needed if using global illumination)
Represent the distant environment as a texture when using local illumination. (Phong)
The intensity and colour of the reflected ray found by texture mapping the environment map onto the rendered polygons
2 types: sphere mapping, and cube mapping.
Sphere mapping
Map the environment onto the surface of a distance sphere surrounding the screen.
Simple calculations to find incident illumination
Inadequate resolution of texels near the boundaries of map, which then leads to distortions on curved surfaces
Cube Mapping
Environment mapped onto 6 faces of a cube
Simple to render map and calculate incident light
Needs to be recalculated for objects changing or changes in viewpoint.
Why do we use Framebuffers to render a cube map
In order to render a cube map, all 6 faces must be accessible.
To render the scene without showing it on the screen, 6 framebuffers are used ; one for each side.
How do we apply environment mapping to our objects
We use cube maps in fragment shaders, given a reflected vector and a side of the cube it returns the pixels that intersected and displays them on the object as a reflection.