Shadow mapping is from Lecture 12. For convenience it is integrated into this lecture note.
Parameterization
Tile-able Texture
Why do we want to interpolate?
Specify values at vertices
Obtain smoothly varying values across triangles
What do we want to interpolate?
Texture Coordinates, colors, normal vectors...
Assume the origin
If all three coordinates are non-negative, then the point is inside the triangle.
Geometric Viewpoint: Proportional Areas
Then:
Formula:
Barycentric coordinates are not invariant under projection!
For each rasterized screen sample, determine its
Texel: A pixel on a texture.
Linear Interpolation:
Bilinear Interpolation: Pick the nearest 4 texels. Do two linear interpolations to get two intermediate values, then do one linear interpolation to get the final value.
Bicubic Interpolation: Pick the nearest 16 texels. Do four cubic interpolations to get four intermediate values, then one cubic interpolation to get the final value.
Mipmap: Allowing fast, approximate, square range queries.
Texture mapping in multiple levels, each the one-fourth of the previous level until the texture becomes 1x1.
Calculating Mipmap Level
Visualization:
Trilinear Filtering:
Do two bilinear interpolation on two adjacent Mipmap levels. Then one linear interpolation to get result on a non-integer level.
Overblur:
Anisotropic Filtering
Ripmaps and summed area tables:
Can look up axis-aligned rectangular zones.
EWA Filtering:
Use ellipse-shaped regions
Multiple lookups
Weighted average
Mipmap hierarchy still helps
Handle irregular footprints
In modern GPUS, textures = memory + range query (filtering)
General method to bring data to fragment calculations
Applications:
Environment Lighting
Environment Map: Describe light sources from the environment.
Directions only
Spherical Environment Map
Prone to distortion (Top and bottom)
Cube Map
Store Microgeometry
Bump/Normal Mapping: Adding surface detail without adding more triangles
Compute the gradient to find out the tangent plane, and then
Calculate the new surface normal.
In 3D, first compute
The perturbed normal is then
in local coordinate.
Displacement Mapping: Move the vertices instead.
Ambient Occlusion Texture Map: Record the status of ambient occlusions on the object.
Procedural Textures
Solid Modeling
3D Procedural Noise: Create noise in 3D space and convert into 3D textures.
Perlin Noise: A procedural texture primitive, a type of gradient noise used by visual effects artists to increase the appearance of realism in computer graphics. All of its visual details are the same size. From Wikipedia.
Volume Rendering
3D Textures
...
From Lecture 12.md
.
An image-space algorithm:
No knowledge of scene's geometry during shadow computation
Must deal with aliasing artifacts.
Key idea: the points NOT in shadow must be seen:
both by the light, and
by the camera.
Classic shadow map:
Can only deal with point/directional light sources.
Pass 1: Render from Light:
Get the depth image from light source
Pass 2A: Render from Eye:
Get the depth image from camera
Pass 2B: Project to Light:
For each sampled point from Pass 2A:
If the depth of that point, when projected back to the light source, doesn't match the depth value in the shadow map, it means that the point has been blocked from receiving light.
Visible Sample:
Invisible Sample:
Precision of the underlying floating-point arithmetic
Scale, bias, tolerance...
Resolution of the shadow mapping (from the view of light source)
Hard shadows (point lights only)
In comparison to soft shadows (light sources with volume)
Utah Teapot
Stanford Bunny
Stanford Dragon
Cornell Box
Used to verify global illumination implementation.
Reference: Normal-Mapping
Normal vectors in a normal map are expressed in tangent space where normals always point roughly in the positive
The TBN Matrix is computed to transform normals from the tangent space to a different space such that they're aligned with the surface's normal direction.
TBN Matrix: Tangent, Bitangent and Normal Vector.
The tangent vector and the bitangent vector align with the direction in which we define a surface's texture coordinates.
Multiplying the acquired normal vector from the normal map, by the TBN matrix, transforms the vector into the global coordinates.