程序代写案例-COMP 5812M

COMP 5812M: Rendering 2022-2023

ASSIGNMENT 1: Raytracing [40 marks]

In this assignment, you will raytrace your own version of an image into a second widget.

You will be provided with a basic OpenGL renderer that reads in a subset of the standard .obj file
format along with a custom .mtl file in ASCII format for material properties.

Lights in the scene are included in the OBJ files, being objects with an emissive property. The code
handed out is able to parse them and have them accessible to you. These have methods to get their
center position or a sampled one.

You should render to the image to the right (framebuffer on RaytraceRenderWidget) using
raytracing. Each of the checkboxes should allow displaying each one of the marked implementation
steps. It is recommended you implement them in that particular order, as functions implemented in
one step will very likely be useful in the next ones.

Tasks:
[7 marks] Geometric Intersections: Calculate geometric intersections between camera
rays and triangles in the input model. Return white when hitting an object.
[4 marks] Barycentric Interpolation: Implement barycentric interpolation to calculate
the value of the normal vector at the position of the intersection calculate in
the previous task, and return it as an RGB value
[5 marks] Blinn-Phong Shading: Calculate Blinn-Phong shading considering every light
present in the scene.
[4 marks] Shadow Rays: Include shadows in your shaded result, also considering every
light source in the scene.
[5 marks] Impulse Reflection: Use the material properties to verify if the object is
mirrored. If it is, calculate the reflected value which should be combined
with the object’s colour accordingly (values are 0 to 1)
[6 marks] Refraction: Use the material properties to verify if the object is transparent
(values are 0 or 1). If it is, calculate the refraction ray keeping track of the
correct IOR and the appropriate shaded result when it hits an opaque
object. Pay attention to total internal reflection, and consider how shadows
may be affected by refraction. Make sure the refracted ray actually
intersects the physical light.
[4 marks] Fresnel: Implement the Fresnel equations (e.g. Schlick approximation),
which will transform part of the refracted light into reflection, and also part
of the diffuse (considered internal refraction) into reflection. Combine
results accordingly.
[5 marks] Monte-Carlo sampled indirect lighting: replace the ambient component of
your computation with a value calculated using monte-carlo sampling. The
code is set up to run as a path tracer when this checkbox is on, so a single
indirect ray per loop should suffice. Pay attention to how the samples are
generated so the result is unbiased.

The first 16 marks should produce images slightly smoother than their left counterparts.
The following 9 marks are simple, if your ray casting function is correctly implemented, and using
recursion.
The next 10 marks require a little bit more of thought into the behaviour of the refracted light, but
should also be achievable with reusing the ray casting function and recursion.
Similarly, the final 5 marks can be achieved in a similar way, which the main challenge being the
correct sampling, and weighting of results..

This renderer is built on Qt, and compiles correctly against Qt 5.13.0 with the following commands in
the labs:

module load legacy-eng
module add qt/5.13.0
qmake
make

It can be launched with:

> ./RaytraceRenderWindowRelease ../path_to/filename ../path_to/materialname

Windows and OSX instructions are available in the readme.txt file provided.

DISCLAIMER:
Other than Qt and the codebase you downloaded with this assignment, ALL code must be written by
you personally. While discussing solutions with colleagues is allowed, sharing code is forbidden.
For late submissions: Pieces of code that are handed out for the next assignment that in theory
could be used in this one will be discounted. They have slight differences in theory which are spotted
by a trained eye.

You must implement all of the functions above using the framework provided, as working within an
existing codebase is a valuable skill to master, and will be graded in this coursework.

Your raytracer must work with the models provided. Each different model has different material
properties. You are free to change those properties for experimentation.

The code MUST run on the University’s Linux system. You may implement on your own machine, but
it will be tested on ours.

PENALTIES:
Poorly structured or badly commented code may be penalised by up to 25% of the marks available.
Code that does not compile properly will be assigned a mark of 0, but I will usually give the student
one chance to correct this.

DUE DATE: Friday, November 18, 10:00 am