












































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













































Lecture 22:
Basic concept (draw diagram)
Three types of secondary rays
Lighting equation
Review – Recursive Ray Tracer
Notice the jaggies in this (recursively) ray-traced image
What’s wrong with it?
How can we fix it?
Supersampling
Left image: one ray per pixel (through pixel center) Right image: 5 rays per pixel (corners + center) Do weighted average of the rays to color in the pixel
Adaptive sampling Supersampling: more samples where we need it (e.g., where geometry or lighting changes drastically) Subsampling: fewer samples where we don’t need detail (faster computation) Beam tracing: track a bundle of neighboring rays together
Supersampling
Questions?
Texture mapping is supported by OpenGL. The general idea is to “wrap” a texture around a geometric surface
It can be incorporated into a Ray Tracer, which will allow for additional lighting effects (diffuse, ambient, specular, transparency, shadows, etc.)
Texture Mapping with Ray Tracer
In general, we can think of texture mapping as a function that “maps” between two domains, position on the surface of an object (domain), and a pixel value from the texture image (co-domain)
Texture Mapping
This is typically done in two steps:
Map a point in the unit (u, v) square to a texture of arbitrary dimension This can be done by linear interpolation between the coordinate space of the unit square to the texture Unit Square coordinate: u is from 0.0-1.0, v is also from 0.0-1. Texture coordinate: w is from 0-width pixels, and h is from 0-height pixels
(1.0, 1.0)
(0.0, 0.0)
unit texturesquare
(200, 100)
(0, 0) (^) texture map
In the above example: (0.0, 0.0)->(0, 0); (1.0, 1.0)->(200, 100); (0.7, 0.45)->(140, 45) Note that the coordinates in (u, v) might not map perfectly to integer values that correspond to pixels. Need to do some interpolation (filter)
Note that we can allow for tiling if the face of a cube is too large If we map a single texture, it could stretch and look terrible So a possible alternative is to use tiling
Mapping a Cube - Tiling
(0, 0) texture map
Tiling Example
Texture
Without Tiling
With Tiling
Mapping a Cylinder / Cone P (^) x
z
P
Find (u, v) coordinate for P Find u the same way as before for cylinders v maps to the “latitude” of the sphere between 0 and 1 (the two caps) At v=0 and v=1, there is asingularity. So set u = a pre- defined value (e.g., 0.5) v is a function of the latitude of P:
Mapping a Sphere
Sometimes, texture mapping the polygons of an object doesn’t get what you are looking for
Texture Mapping Complex Geometry
Original Geometry (^) Texture each face separately (notice discontinuities)
Texture the object as a continuous object
Use a bounding sphere… Find the ray’s intersection (in object space) with a bounding sphere, called P Find P’s coordinate in the texture map’s (u, v) coordinate Apply the texture to the point on the underlying geometry (the house)
Basic Idea