Comp261 Assignment 3 The 3D Renderer solution

$24.99

Original Work ?

Download Details:

  • Name: COMP261-Assignment3-ezox47.zip
  • Type: zip
  • Size: 393.46 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

Rate this product

The goal of this assignment is to write a program that implements a simple but complete pipeline
for rendering 3D shapes represented by polygons. This assignment is a lot larger than the previous
two, you should provision your time accordingly.
Resources
The assignment webpage also contains:
• An archive of template code (including a GUI you may use) and a small example class.
• An archive of model files and images of what they look like.
• A marksheet.
To Submit
You should submit four things:
• All the source code for your program, including the template code. Please make sure
you do this, without it we cannot give you any marks. Again: submit all your .java
files.
• Any other files your program needs to run that aren’t the data files provided.
• A report on your program to help the marker understand the code. The report should:
– describe what your code does and doesn’t do.
– describe any bugs that you have not been able to resolve.
The report should be clear, but it does not have to be fancy – very plain formatting is all
that is needed. It must be either a txt or a pdf file. It does not need to be long, but you
need to help the marker see what you did.
A simple 3D rendering pipeline
3D graphics rendering ranges from fast approximate rendering, used for example in video games
and other real time rendering, through to complex ray tracing and sophisticated modelling, for
1
generating high quality images and animated films. There are a wide variety of data structures
and algorithms used in 3D rendering.
For this assignment, you must write a program that performs a simple rendering of shapes
represented by polygons, using a Z-buffer, using the algorithms described in the lectures.
The simplifications:
• All polygons are triangles.
• Only diffuse reflection will be required – no specular reflection.
• There will be a single directed light source, with a fixed intensity, placed at infinity in a
specified direction (so that the incident light is from the same direction at every point on
the shapes).
• The shapes will be automatically zoomed and translated to all fit in the image, so that no
objects need to be clipped.
• The polygon surfaces are assumed to be flat and have a uniform reflectance so that the
light reflected from every point on the polygon is the same (there is no need to interpolate
the reflected light intensity or the surface normals).
• The coordinate system is assumed to have the origin at the top left x increases to the right,
y increases down, z increases away from the viewer (this is a right handed system that is
also convenient for converting to a 2D image).
Outline of your renderer
Your program should implement the pipeline described in the lectures:
• Read the lightsource direction and all the polygons from the file
• Rotate all the polygons so that the view direction is along the z-axis. Rotate the lightsource
direction by the same amount.
• Compute the bounding box of the collection of polygons then translate and scale all the polygons so that they all fit within the image (ie, 0<=x