, , , , , , ,

[SOLVED] Csci 3260 assignment 2: texturing and lighting

$25

File Name: Csci_3260_assignment_2:_texturing_and_lighting.zip
File Size: 433.32 KB

5/5 - (1 vote)

I. Introduction
In this assignment, you are required to build an even more realistic and complex scene with OpenGL. To
achieve this task, you will experience more features in OpenGL, including lighting, complex model building and
loading, texture mapping and interactive events.You are about to use a primitive drawing or load a 3D model from
a .obj file directly and then view/model the transformation to create this 3D scene. Texture mapping and lighting
will be employed to make the scene and objects more realistic. Mouse/keyboard inputs and window event handling
will help in realizing the interactive animation.Fig. 1: The scene captured in the demo
In this assignment, there are two models in the scene. One of them (the background ground) is relatively simple,
the other (the dog) is complex. We can design the vertex attributes of the background ground by ourselves.However,
for the dog, it is so complicated that we need to load the models by .obj files. Besides, the ground and the dog are
rendered with different textures and lighting effects. The scene displayed can be controlled by the user’s interactive
input. You can also enrich the scene which you created in assignment 1.Use the Open Asset Import Library, or the function ‘Model loadOBJ(const char* objPath)’ which we have
given to load at least one complex model, i.e. the dog in the demo program. In this part, you can use ‘Model
loadOBJ(const char* objPath)’ function by modifying the ‘void sendDataToOpenGL()’ subroutines.We have provided the models in the demo program, i.e.ground.obj and dog.obj. You are encouraged to
download other .obj files from the Internet or use Blender to design your objects.(You need to inspect the dog.obj because if you directly draw the dog, it will be a little small. Specifically,
you need to do some transformations.)You need to map different textures to the two models, i.e. the ground surface and the dog in the demo program.
We will use the stb image library (see “Dependencies/stb_image”) to load the texture images. You are required to
change the texture of the dog by using keyboard interaction.You firstly need to generate one OpenGL texture and
set the texture parameter by modifying the ‘void Texture::setupTexture(const char* texturePath)’
subroutines. Then, load and bind textures to different models in ‘void sendDataToOpenGL()’ and ‘void
paintGL(void)’ subroutines, respectively.Here, we have also provided the textures of the two models in the demo program. You are also encouraged to
download other textures from the Internet or draw/filter texutures by yourself.Also, the 3D scene should be illuminated with at least two light sources. One should be an environment
(directional) light. For the other light sources, you can decide the position and color by yourself. The main purpose
of adding such light sources is to produce the diffuse light and specular light effects on the models. You can do this
by modifying the ‘void paintGL(void)’ subroutines.In this task, you are required to implement the following interactive events and animation:
(a) Lighting control
Press key “w” and key “s” to increase and reduce the brightness of directional light, respectively.(b) Texture control
Press key ’1’ and ’2’ to switch two different textures for the dog, and we have also provided two textures
which can be applied on the dog. (i.e. dog/dog_01.jpg, dog/dog_02.jpg)
Press key ’3’ and ’4’ to switch two different textures for the ground surface, and we have also provided two
textures which can be applied on the ground. (i.e. ground/ground_01.jpg, ground/ground_02.jpg)(c) Object control
Press arrow keys “↑↓←→ L” to control the movements of the dog. Specifically, “↑↓” indicate up
and downward movement respectively. “←→” indicate left and right rotation respectively and ‘L’ indicate
the random movement in the horizon plane. (See the animation of the dog in the demo program)(d) View controlControl the view of camera by mouse, which means:
When the left button clicked and the mouse moves up and down, the whole scene you see moves up and
down accordingly.
(See the demo program. The right-click function does not require.)In this task, you may modify the following subroutines to implement above requirements:
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{
// Sets the mouse-button callback for the current window.
}
void cursor_position_callback(GLFWwindow* window, double x, double y)
{
// Sets the cursor position callback for the current window
}
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
{
// Sets the scoll callback for the current window.
}
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
// Sets the Keyboard callback for the current window.
}Bonus Task: Enhance the visual effect of your scene (maximum 20%)
OpenGL provides many functions for your program to create various visual effects. You can study them by
yourself and introduce them into the assignment.Here are some suggested improvements:
• Load more complex models and map other textures onto them to form a meaningful scene as you like.
(10%)
• Use different types of lighting sources to make meaningful scenes, such as the combination of Pointlight,
Spotlight, etc. (10%)• Shadow mapping on complex models. (10%)
• Draw points or lines to trace the movement of one of the complex models. (10%)
• More complex movement, such as circle movement, etc. (10%)
• Any other interesting effects.III. Grading Scheme
Your assignment will be graded by the following marking scheme:
Basic (100%)
Loading the complex model 12%
Texture mapping 12%
Lighting of environment (directional) light 12%
Lighting of light source you designed 12%
Lighting control 12%
Texture control 12%
Object control 16%
View control 12%
Bonus 20%
Total: 120%
Note: no grade will be given if the program is incomplete or fails compilation.IV. Guidelines to submit programming assignments
1) You can write your programs on Windows and macOS. Previously, the official grading platform is Windows
with Visual Studio. If we encounter problems when execute/compile your program, you may have to show your
demo to the tutor in person.2) Modify the provided main.cpp & VertexShaderCode.glsl & FragmentShaderCode.glsl and provide all your
code in this file. You could create additional .glsl files if you would like to implement the shadow mapping
technique. Type your full name and student ID in main.cpp. Missing such essential information will lead to
mark deduction (up to 10 points).3) We only accept OpenGL code written in the programmable pipeline. No points will be given if your solution
is written in the fixed pipeline.4) We only accept OpenGL code implemented with GLFW and GLEW. No points will be given if you use other
windowing and OpenGL extension libraries (unless you have strong enough reasons).5) Zip the source code file (i.e. main.cpp & VertexShaderCode.glsl & FragmentShaderCode.glsl), the
executable file (e.g., openGL.exe if you use windows) or the project file (csciasig2.xcodeproj for Mac
users), and the readme file (i.e., readme.txt) in a .zip (see Fig. 3), the readme file (i.e., readme.txt), the .obj
files you create or download and the image files you create or download in a .zip. Name it with your student id
(e.g. 1155012345.zip).6) Submit your assignment via eLearn Blackboard. (https://blackboard.cuhk.edu.hk)7) Please submit your assignment before 11:59 p.m. of the due date. Late submission will be penalized as
introduced in lecture 01.
8) In case of multiple submissions, only the latest one will be considered.9) Fail the course if you copy.
10)
11) Fig. 3, Files to be submitted.
For Mac

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] Csci 3260 assignment 2: texturing and lighting
$25