CSS552: Programming
Assignment #4
Texture Mapping and Triangle
Due Time: Refer to the course
web-site.
Objective
The
goals of this programming assignment are for us to implement, experience, and
understand integrating a primitive into the ray tracing system and with texture
mapping procedures: explicit image file texture, and implicit procedural
texture.
Approach
Please
refer to my solution. Here are the command files (with sample rendered images).
You should download and unzip both of these files, then double click on the exe
to run the sample program. In this assignment, you are to implement the
math for position to UV mapping for the sphere, and implement checker, sine,
ramp, and compute the implementation of the triangle geometry. Please download this starter project and unzip the source
code.
The RayTracer
Project
By now, we should all be quite familiar with this project from our mp1
experience. In mp1 you spent time implementing the visibility computation in
the RTCore_Compute.cs file. In mp2, we will implement the Phong
illumination model in the ComputeShading() function in the RTCore_Shade.cs
file. The ComputeShading() function is invoked once to compute
for the color of each visible sample from the ComputeImage() function.
In this version of the ray tracer, we want to pay attention to:
- RTCore::ComputeShading(): notice we access every
single shading parameters via the RTMaterial class now!! For example,
instead of access the normal vector at the visible position from the
IntersectionRecord, in this latest version we call RTMaterial.GetNormal().
This indirection allows RTMaterial to map and lookup a
modified version of the normal vector! This is how bump map is
implemented. We will see example implementation of bump mapping in class.
- RTMaterial: Notice the TexturableAttribute<> class. Notice
many of the elements in the material class are "texturable" now!
Including transparency!
- RTTextureType: Pay attention to the RTTextureType hierarchy. You
must modify each of the texture types (Sine, Checker, Ramp). The number of
lines required is very small, but you must understand what you are doing.
- RTSphere: You must support the math for 3D position to UV mapping
for the sphere.
- RTTriangle: You must
complete the parsing, response to UI support (for interactive showing), intersection
routine, and the 3D position to UV mapping.
Credit Distribution
Here
is how the credits are distributed in this assignment:
- 20%: Sphere: Position to UV mapping to support image file texture
mapping
- 30%: Triangle:
parsing + support UI showing
- (5%) Correct parsing of
triangle (note, the StartProject will crash if you try to parse command
files that has a triangle!).
- (5%) Correct response
to GetVertices()
- (15%) Correct
intersection for visibility support
- (10%) Correct UV
mapping support
- 15%: Checker Texture:
- (10%) Respect UV repeat
- (5%) Respect
color1/color2
- 15%: Sine Texture:
- (5%) Respect period
- (8%) Respect direction
- (2%) Proper and smooth
changing between the two colors
- 10%: Ramp Texture
- (6%) Proper repeat
- (4%) Smooth color
transition
- 10%: Proper submission and efficiency
- (5%) no useless files
- (5%) no useless
computations in texture implementation
Extra Credits
- 5pt: Support texture mapping of light source color (think,
how you can have a spot light that shoots illumination according to a
check texture, where checker regions are either illuminated or dark).
- 5pt: Support texture placement, instead of UV covering the
entire rectangle, allow user to specify a sub-region in the rectangle for
texture mapping.
This programming assignment will count 12% towards your final grade for
this class.