Home Page > > Details

COMP3170 Assignment 3 Moonlit forest

 COMP3170 Assignment 3

Moonlit forest
This assignment covers the following topics:
• 3D modelling with triangular meshes
• 3D Transformations
• Perspective cameras
• Fragment shaders
• Illumination and shading
• Texturing
This is a two-person group assignment. Your task is to build a simple 3D scene of a snowy 
forest in the moonlight, like this:
A basic framework for the assignment is available via the GitHub classroom link on iLearn.
Scene features
Your mark will be based on the features you implement, from the list below. Each feature 
has a mark value attached. Completing more than 100% worth of features will not earn 
additional marks. Details below. The more challenging elements are marked with an 
Feature Marks
Forest meshes
• Tree trunk
• Tree canopy
• 40 random trees
• Snow on the ground plane
• Tree trunks
• Tree canopy
• Colour
• Cone UVs calculated in shader*
• Perspective camera with appropriate view volume
• Aspect matches window
• Movement with keyboard controls
• Mesh
• Rotates around world
• Always at back of scene (implemented in shader)*
• Directional light based on moon position
• Moon light fades to zero as it drops below the horizon
• Secondary point light at player (torch)
• Torch intensity drops off with distance
• Player torch direction controlled with mouse*
• Ambient and diffuse lighting on ground
• Specular lighting on ground
• Ambient and diffuse light on trunk and canopy
• Canopy fragment normals calculated in shader*
Total 100%
General requirements
Your scene should be implemented using:
1) Anti-aliasing using 2x2 supersampling.
2) Backface culling
3) Mipmaps for all textures (with trilinear filtering)
4) Gamma correction (with a default gamma of 2.2)
Correctness marks will be deducted if these not implemented correctly.
Forest meshes
• The forest should consist of a 40x40m ground plane, as a flat square (provided in 
• 40 trees should be randomly distributed on the ground plane
• Each tree is made of two parts:
o A cylindrical trunk
o A conical canopy of leaves
• Each tree should be between 5m and 10m tall, with random variations in both trunk
and canopy heights and radii.
The ground plane should be textured using the snow.png texture provided.
• The texture should repeat 20 times across the square in each direction.
The tree trunk and canopy should be textured using the tree.png texture provided.
• The texture should repeat two times horizontally and vertically around the trunk.
• The texture should repeat four times horizontally and three times vertically around 
the canopy.
• This texture provided is greyscale. Colouring should be implemented in the shader, 
so the canopy is green and the trunk is brown.
• Note: Calculating texture coordinates for a cone is more difficult than usual. The 
standard technique of setting vertex UVs and interpolating them doesn’t give good 
results. So, you will need to write a purpose shader to calculate UVs for the canopy. 
The method involved will be discussed in tutorials.
• The camera should have a perspective projection with an appropriate vertical field 
of view.
• The near and far planes of the camera should be set so the player can see the full 
extent of the landscape from any position without any obvious culling. However, the 
view volume should also not be excessively large.
• The aspect ratio of the camera should match the aspect ratio of the window, so the 
view does not distort when the window is resized.
• The camera should sit 1.5m above the terrain.
• The camera should move with the keys:
o W/S moves forwards and backwards
o Q/E strafes left and right
o A/D turns left and right
• There is no need to handle colliding with trees or walking beyond the extent of the 
The Moon
• The moon is a white sphere.
• The moon should rise and fall, rotating around the world once every 2 minutes.
• The moon should always render behind other objects in the scene. This should be 
implemented in the fragment shader by adjusting the depth values for fragments.
• There should be a very low level of ambient lighting.
• The Moon should be a source of directional lighting, based on its position in the sky.
• When the moon is below the horizon, its intensity should fade to zero.
• There should be a secondary point light source at the player’s position, representing 
a torch held by the player. It should have a yellowish colour. Pressing space turns the 
torch off and on.
• The intensity 𝐼 of the torch should fall off with distance 𝑑 using the equation: 
𝐼 =
• The torch light should only have effect within a cone with an angle of 30° centred on 
the mouse position.
• All lighting should be implemented as fragment lighting (i.e. based on fragment 
• The ground should implement ambient, diffuse and specular lighting (with a low 
specularity) so the snow appears brighter when facing toward the moon.
• The tree canopy and trunk should implement ambient and diffuse lighting, with 
appropriate normals.
• Note: computing normals for a cone by interpolating vertex normals will not yield 
accurate results. To shade the tree canopy, you will need to calculate normals 
directly in the fragment shader, based on the model coordinates of the fragment.
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, including:
o the origin
o the x, y, z axes
o the coordinates of each vertex in model coordinates
o the triangles that make the mesh
• Diagrams illustrating the lighting calculations, including:
o Diffuse lighting from the moon
o Specular lighting from the moon
o Diffuse lighting from the torch
o Specular lighting from the torch
o Calculation of the intensity and cone shape for the torch
Your Java project will be submitted using Github Classroom. Your most recent commit to 
the repository before the assignment deadline will be marked. 
Your report will be submitted using iLearn as a PDF.
No late submissions will be accepted, except in the case of special consideration (which 
requires a formal application). Last minute problems with Git are not an excuse for late 
submission. Remember to commit and push your work regularly as you go.
Peer assessment
You will also submit individual peer assessment reports, using the template provided on 
iLearn, to assess both your own contribution and that of your teammate. You need to 
provide a grade (following the rubric given in the template) and a justification for the grade. 
This grade will be kept private from your teammate but will be used as evidence to adjust 
the final individual grade weighting
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 group 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%) 
= 84.9%
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%
Individual marks will be assigned based on peer assessment and evidence of contribution 
(e.g. commits in the GitHub repo). Generally, your individual mark will be equal to your 
group mark unless there is evidence of a substantial disparity in the amount of work 
performed by each group member.
Grade Correctness Clarity Documentation
Contact Us - Email:99515681@qq.com    WeChat:codinghelp
Programming Assignment Help!