$30
TASKS
You are to complete an OpenGL program to draw a skybox and perform normal mapping, procedural bump mapping and reflection mapping. The following image shows a sample view of the result that your program is expected to produce:
Figure 1
The background is part of a skybox. A skybox is used to show the supposedly-infinitely-faraway surroundings of a 3D scene. It is made of a 3D cube texture-mapped with an environment map (a cubemap), and the cube encloses the 3D scene and the camera.
The cube on the left side of the sample image is rendered with a brick texture map and a corresponding normal map. The color texture map is used to provide the ambient and diffuse material for the Phong lighting computation.
The cube on the right is rendered with a wood texture map, where it provides the ambient and diffuse material for the Phong lighting computation. The cube also has an array of hemispherical mirrors, and these mirrors reflect the environment (same environment map as used for the skybox). The mirrors are produced using procedural bump mapping, and their reflection of the environment is produced using reflection mapping with a cubemap.
——————————
Please download the ZIP file cs4247_2021S2_assign1_todo_(*).zip from the Assignments folder in LumiNUS Files. You can try the executable program main_done.exe (or main_done on macOS) found in the same ZIP file. The program does not produce correct rendering right now since it is using the incomplete shaders.
You need to complete the C++ application program main.cpp and the fragment shader assign1.frag. In the fragment shader, all necessary uniform variables, and global input/output variables have already been declared, and you must not add new ones. You can add new functions in your shader. Note that you should adhere to the variable naming convention where the prefix “ec” is used to indicate that the entity is expressed in the eye space, the prefix “wc” to indicate world space, and the prefix “tan” to indicate tangent space.
A Visual Studio 2017 solution main.sln (or Xcode project assign1.xcodeproj on macOS) is provided for you to build the executable program. The application program loads the shader source files assign1.vert and assign1.frag, and use them in the rendering. It also provides the values for the vertex attributes and uniform variables to the shaders. In this assignment, you are not required and must not change any other C/C++ source files besides main.cpp.
There are three separate tasks in this assignment:
Task 1: Skybox
For this task, you need to modify main.cpp such that the skybox cube is sized and positioned correctly. Please read the instruction provided in the given code to find out the details. The skybox cube is to be texture-mapped with an environment cubemap, and this cubemap has already been set up by the application program. Please note that the view of the skybox will change only when the camera rotates, and should not change at all when the camera translates. This is because the environment on the skybox is supposed to be infinitely far away.
Task 2: Brick Cube
For this task, you need to modify assign1.frag to render the brick cube using normal mapping. Please read the instruction provided in the given code to find out the details.
Task 3: Wooden Cube
For this task, you need to modify assign1.frag to render the cube with wood texture and produce the array of hemispherical mirrors using procedural bump mapping. Please read the instruction provided in the given code to find out the details. Note that the bumps must appear as if they are hemispherical. In addition, the reflection of the environment must match the orientation of the skybox.