Best代写-最专业靠谱代写IT | CS | 留学生作业 | 编程代写Java | Python |C/C++ | PHP | Matlab | Assignment Project Homework代写

代码代写|Game Engines and Graphics – Assignment 2 Part A 3D Environments

代码代写|Game Engines and Graphics – Assignment 2 Part A 3D Environments



1 Overview

This assignment has 2 major deliverables Part A – OpenGL Scene Renderer and Part B – Unity Environment. You should complete and submit part A before you begin part B.

Assignment 2 overall is worth 50% towards your grade and has two subassessment items:

Part A – OpenGL Scene Renderer (50%)

Part B – Unity Environment (50%)

2 Part A – OpenGL Scene Renderer Introduction

In this assignment you will implement a scene viewer in OpenGL. The assignment is structured to gradually introduce more advanced OpenGL concepts, beginning with a simple triangle. Each step introduces a new aspect of OpenGL.

For best results complete the steps in the order given.

2.1 Overview of Starting Code

The assignment includes many Java classes. Some of these you will need to

modify when you implement the assignment, and others do things for you.

2.1.1 Packaging

The starting code is structured into Java packages to make it easier to keep things organised. Four packages are provided:


This package contains the main Assignment class,which starts the program. It also contains the AssignGLListener that you will implement to build your application.


This package contains classes that can be rendered on screen. You will need to modify many of these classes to have them render on screen.

This package contains classes for different lights. You will need to use these classes to implement lighting in your scene viewer.


This package contains the math classes that you will need to use when performing mathematical operations.


This package contains the scene loader and scene specific classes that are not drawables. You will need to use Scene to decide what to render, and Camera to calculate the view and projection matrices.

2.1.2 Classes you will modify

  • AssignGLListener
  • Box
  • Cone
  • Cylinder
  • Geometry
  • Sphere
  • Texture
  • Triangle

2.1.3 Shaders

You will also need to write several GLSL shaders. Empty, correctly named,shader files can be found in the shaders directory.

2.2 Starting your implementation

A set of suggested steps is provided below to walk you through the assignment.

There are a number of optional features you may attempt once the basic rendering is working. Please refer to the marking sheet below to help you decide which are optimal for your final grade.

2.2.1 An Empty Window

At the end of this step you will have a black window on screen. This may not sound like much but you’ll have a lot of the groundwork taken care of. Do the following:

  1. Get the starting code into your IDE of choice and make sure everything compiles
  1. Modify AssignEventListener’s init method:
  2. Set the clear colour to black
  3. Enable back-face culling
  4. Modify AssignEventListener’s display method:
  5. Clear the depth and color buffers Result:


2.2.2 A Red Triangle

  1. Implement the Triangle class:
  2. The init method should load the positions of the vertices to OpenGL
  1. The display method should render the triangle
  2. Create a vertex shader named SimpleShader.vert. This shader should read in the vertex position and pass this through to the next stage.
  1. Create a fragment shader named SimpleShader.frag that sets the colour of the fragment to red (1.0,0.0,0.0,1.0)
  1. Load and use your shader to render the scene SimpleTriangle.scene Result:


2.2.3 Vertex Colours

A red triangle is great, but other colours are better. The vertices of the Triangle class have colours associated with them. In this step we’ll make use of them.

  1. Modify your triangle class by adding a vertex attribute for the colour
  2. Create new vertex and fragment shaders, named VertexColour.vert and

VertexColour.frag to use these colours.

  1. Load and use this shader to render the scene ColouredTriangle.scene Result:

2.2.4 View Transformation

At this step we will implement projection and view transformation and start seeing the 3D world.

  1. Create projection and view matrices from the Camera class loaded in the scene.
  1. Create a new vertex shader Transform.vert which transforms the incoming vertex using the projection and view matrices.
  1. Send the projection and view matrices to the shader as uniform variables.
  2. Render the scene PerspectiveTest.scene using the Transform.vert vertex shader and VertexColour.frag fragment shader.
  1. Implement reshape in your listener to correctly reset the projection matrix when the window is resized. Result: