Assignment 1 Helicopter
Topics covered:
• Drawing 2D meshes
• HSV and RGB colour spaces
• Bezier curves
• 2D transformations: rotation, translation, scale
• Animation
• Scene graph
• Viewport
• 2D camera: view and projection matrices, aspect
• Instancing
Task Description
Your task is to implement a scene with a forest of autumn-coloured trees and a flowing river (Figure 1). A helicopter flies over the scene, controlled by the mouse.
Figure 1: A helicopter flying over an autumnal forest and river.
For this assignment, you will need the Eclipse project containing the LWJGL and JOML libraries that we have been using in the workshop classes. See the week 1 workshop for instructions to download and install this project. Make sure to pull the latest version of the library from the repository before beginning the project.
A basic framework for the assignment has been provided in GitHub Classroom:
https://classroom.github.com/a/yc4IU0um
Accept the assignment to clone it into your own Github account.
It contains the files:
• Assignment1.java
• vertex.glsl / fragment.glsl – a basic, simple shader.
To complete the assignment, you will need to edit these files and add further classes of your own.
Components
You are required to complete each of the components below. Each component contributes a percentage towards your Completeness mark, as described below. Note that not all components are of equal difficulty.
Note: In the spec, some specific numbers (e.g. the colour and size of the helicopter, colour of the river, etc) are not specified. You are free to choose whatever values you feel appropriate for these as long as they illustrate the behaviour required. However, remember to use named constants in your code (with comments to indicate units) to allow these values to be easily modified. Clarity marks will be deducted for using ‘magic numbers’ (i.e., embedded numerical constants given without explanation).
General Requirements
• You should use the SceneGraph implementation provided in the comp3170.23s1.lwjgl project to organise the objects in your scene.
浙大学霸代写 加微信 cstutorcs
Tree – Mesh (5%)
Create a tree mesh with a short rectangular trunk and a circular ball of leaves, as illustrated in Figure 2.
Figure 2: A single tree
Tree – Colour (5%)
Colour the trunk of the tree brown. For the ball of leaves, randomly choose a hue from red (H=0) to green (H=0.33) in HSV space, as shown in Figure 3:
Figure 3: Various hues of tree from green to red.
Tree – Shading (5%)
Use vertex shading to colour the outside of the ball of leaves a different hue to the centre, as shown in Figure 4.
Figure 4: Tree with vertex shading on leaves.
Forest (10%)
Clear the background to dark green. Randomly position 1000 trees in a 100 x 100 area of world-space, as shown in Figure 5. Trees at the bottom of the screen should be drawn in front of trees above them.
Figure 5: A 100×100 forest containing 1000 trees.
River – Mesh (10%)
Generate a river mesh with an S-shaped curve, computed using a Bezier curve (Figure 6). The width of the river should increase from the start to the end.
Figure 6: A Bezier-curve river through the middle of the forest.
River – Shading (5%)
Shade the river by blending light and dark shades to give the impression of ripples (Figure 7). The ripples should be aligned at right angles to the direction of the river.
Figure 7: The river shaded with light and dark ripples.
River – Animation (5%)
Animate the ripples so they slowly move downstream (see example video).
Helicopter – Mesh (10%)
Create a mesh of a helicopter with two rotors, as shown in Figure 8.
Figure 8: A dual-rotor helicopter.
程序代写 CS代考 加微信: cstutorcs
Helicopter – Animation (10%)
Animate the rotors to spin in opposite directions to each other (see example video).
World camera (10%)
Create a camera that follows the position of the helicopter, so the helicopter is always at the centre of the screen (Figure 9). The camera should remain aligned with the world X/Y coordinates and should not rotate when the helicopter rotates.
Figure 9: A camera with a 50×50 view volume, centred on the helicopter.
World camera – resizing (10%)
The view volume of the camera should be adjusted proportional to the size of the window. A 1000×1000 window should show a 50×50 area of world space (Figure 9). Making the window larger (or smaller) should reveal more (or less) of the world without changing the screen size of objects displayed (Figure 10).
Figure 10: The same scene as Figure 9 in a smaller window.
Code Help
Mouse control – Idle (5%)
When idle, the helicopter should rotate at a fixed speed to face the mouse cursor (see example video).
Mouse control – Moving to target (5%)
When the mouse is clicked, a marker should be placed at the mouse position. The helicopter should rotate (at fixed speed) to face the marker and move forwards (at fixed speed) until it reaches the location (Figure 11). It should then remove the marker and start idling again.
Figure 11: The helicopter moving towards the position indicated by the cross marker.
Clicking the mouse while the helicopter is in motion should move the marker to the new mouse position (see demo video). The helicopter should rotate and move towards the new location.
Instancing (5%)
Implement the forest using instancing so all the trees are drawn in a single draw call.
Documentation
In addition to your code, you should submit a PDF report following the Word template provided. The report should include:
• A completed table indicating the features you have attempted.
• An illustration of the scene graph used in your game.
• Illustrations of all the meshes used in your game, drawn to scale in model coordinates,
including:
o the origin
o the x and y axes
o the coordinates of each vertex
o the triangles that make the mesh
• A diagram illustrating the world camera calculations, including: o The viewport rectangle
o The mapping from view (camera centric) coordinates to NDC o The mapping from NDC to viewport (pixel) coordinates
Submission
Your Java project will be submitted using Github Classroom. Your most recent commit to the repository before the assignment deadline will be marked. Practice good version control habits of regular commits with clear and meaningful commit messages.
Your report will be submitted using iLearn as a PDF.
Your marks will be calculated using three components (according to the rubric below):
• Correctness: Whether your code is correctly implemented.
• Clarity: Whether your code is easy to understand.
• Documentation: Whether your report contains all the required elements.
This mark will be scaled based on a Completeness mark, which refers to the total value of the components you have attempted. Each component is worth between 5% and 10%, as detailed in the Report Template.
Your final mark will be determined using the formula:
SQRT(Completeness * (60% * Correctness + 20% * Clarity + 20% * Documentation))
So, for example if you attempt 80% of the features above, with perfect correctness (100%), slightly sloppy code (70%) and some minor sloppiness in the document (80%), your final mark would be:
SQRT(80% * (60% * 100% + 20% * 70% + 20% * 80%)) = SQRT(80% * (60% + 14% + 16%))
= SQRT(80% * 90%)
On the other hand, if you only attempt 50% of the features above, to the same level of quality (90%) your final mark would be:
SQRT(50% * 90%) = 67.1%
Grade Correctness (60%) Clarity (20%) Documentation (20%)
Excellent work. Code is free from any apparent errors. Problems are solved in a suitable fashion. Contains no irrelevant code.
Good consistent style. Well structured & commented code. Appropriate division into classes and methods, to make implementation clear.
All sections are complete and accurately represent the code. All diagrams are neat, clear, and well annotated.
Very good work. Code has minor errors which do not significantly affect performance. Contains no irrelevant code.
Code is readable with no significant code-smell. Code architecture is adequate but could be improved.
All sections attempted with minor sloppiness or missing detail. No discrepancies between documentation and code.
Good work. Code has one or two minor errors that affect performance. Problems may be solved in ways that are convoluted or otherwise show lack of understanding. Contains some copied code that is not relevant to the problem.
Code is readable but has some code-smell that needs to be addressed. Code architecture is adequate but could be improved.
All sections attempted with minor sloppiness or missing detail. Minor discrepancies between documentation and code.
Poor. Code is functional but contains major flaws. Contains large passages of copied code that are not relevant to the problem.
Significant issues with code quality. Inconsistent application of style. Poor readability with code-smell issues. Code architecture could be improved.
All sections attempted with significant sloppiness and missing detail. Minor discrepancies between documentation and code.
Code compiles and runs, but major elements are not functional.
Significant issues with code quality. Inconsistent application of style. Poor readability with code-smell issues. Messy code architecture with significant encapsulation violations.
Some aspects incomplete. Diagrams unclear and badly drawn. Does not make use of graph paper. Coordinate systems not properly annotated. Major discrepancies between documentation and code.