In this assignment, you will write a very simple ray tracer. The core requirement is to trace a sphere and a cube with C# code and Unity. This introductory assignment aims at getting you familiar with the Unity game framework as well as C# programming, and practise basic operations with ray, geometry and shading/texturing.
The deadline is firm as the first assignment is designed with low difficulty and no “advanced requirements”.
You’re free to use any technology you like to program assignments, but Unity is recommended for beginners. If you use anything other than Unity, make sure you talk to your TA/instructor before you submit. You’re responsible to implement all functionality by yourself, including those code samples given in the lab session, and the assignment requirements, with own preferred technology.
Generate the following renderings, with the given ray-tracing code framework in Unity or your preferred graphical programming technology.
In this assignment, the only graphics API allowed is Unity’s Texture2D.SetPixel(x, y, color), or similar functionalities in other frameworks. All calculations of ray geometry, intersection, shading and UV mapping need to be demonstrated in your own (CPU-side) code.
Implement ray-sphere intersection and render a sphere with ambient, diffuse and specular lighting (40%).
Implement ray-triangle intersection and visualize the barycentric coordinate on each of the triangles of a cube, with Red, Green and Blue for each coordinate. (30%)
Implement UV mapping with the calculated barycentric coordinate in the previous step, and visualize a texture image on each face of the cube. (choose any texture you like)