

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!


For this assignment you will add texture mapping with bitmaps and procedu- ral texturing to your ray tracer. We have added some supporting functionality to the base code that will help you to solve the assignment. Please download the updated base code from the class web site. Submit your project as a compressed archive via email as usual. Please do not forget to include rendered images as visual results for all subproblems.
Implement a material that supports 2D texturing with bilinear texture interpo- lation. The RGB texture values should be used as diffuse shading coefficients. Note that the new base code allows the specification of materials with tex- tures in the scene file. We also provide sample scene files and textures that you should use for testing.
Implement texture mapping using mip-maps and tri-linear filtering. The new base code includes a mip-map class that pre-computes a texture pyramid, i.e., all the levels of the mip-map. You will only need to add a method for trilinear interpolation. This assignment is restricted to mip-map level computation for textured triangles. Find the mip-map level using the inverse J−^1 of the Jacobi matrix J, where
[ (^) ∂x ∂u
∂x ∂y ∂v ∂u
∂y ∂v
, and J−^1 =
[ (^) ∂x ∂u
∂x ∂y ∂v ∂u
∂y ∂v
∂u ∂x
∂u ∂y ∂v ∂x
∂v ∂y
as discussed in class. You should compute the Jacobi matrix and its inverse in the triangle intersection method. The resulting partial derivatives ∂u/∂x, ∂u/∂y, ∂v/∂x, ∂v/∂y should be passed to the shader via the hit record. A
more detailed explanation of how to implement mip-mapping is provided in the accompanying document on the class web site. Test your implementation by visualizing the mip-map level at each pixel. Let us call the per-pixel level l and assume that 0 < l < 4. Write a shader that simply assigns the color (max(b 64 · lc, 255), max(b 64 · lc, 255), max(b 64 · lc, 255)) to each pixel. Render the test scene test mipmap levels.txt and compare the result to our reference solution mipmap levels.ppm. For the comparison, make an executable using the project compare ppm, which is provided with the new base code, to compute the squared per-pixel difference between two .ppm image files. Note: The test mipmap levels.txt scene file, the mipmap levels.ppm reference image, and the compare ppm project will be available on the class web site by Friday May 5.
Implement bump mapping by interpreting texture values as normal displace- ments d(u, v). Given an original surface p(u, v) with normals n(u, v), the tex- ture describes a new surface p′(u, v) = p(u, v)+d(u, v)n(u, v). Compute surface normals n′(u, v) of the displaced surface using the equations
n′(u, v) =
∂p′(u, v) ∂u
∂p′(u, v) ∂v
∂p′(u, v) ∂u
∂p(u, v) ∂u
∂d(u, v) ∂u
n(u, v), ∂p′(u, v) ∂v
∂p(u, v) ∂v
∂d(u, v) ∂v
n(u, v),
and evaluate shading using these normals. You should compute the partial derivatives ∂p(u, v)/∂u and ∂p(u, v)/∂v in the triangle intersection method and return them in with the other intersection data in the hit record. Note that finding the Jacobian J for the mip-map level computation already includes the computation of p(u, v). Since p(u, v) is a linear mapping it is straightforward to compute its derivatives.
Implement solid texturing using procedural textures based on Perlin noise. Note that we provide an implementation of Perlin’s noise function with the new base code. Render test images using a single noise frequency and using turbulence. Extend the basic turbulence function to simulate marble. Perform further ex- periments with turbulence to generate one more interesting material.