CPI 411 Graphics for Games
Assignment 2 (Environment Map)
This assignment is to develop an environment map tool to demonstrate several reflection and refraction algorithms. You are asked to implement following items in MonoGame and Visual Studio. Several items in gray are from the previous assignment. If you could not complete them, check the solution posted in the course web site.
• Basic User Interfaces
• Geometry and Image Loader
• Reflection and Refraction Shaders
A. Basic User Interfaces (5 Pts)
When you develop a computational 3d tool, first step is to develop the interface to control the view and transform the objects like a 3ds max and Maya. In order to implement mouse dragging controls, the offset (x, y) should be calculated between the current mouse position and last mouse position. The last position is updated with the current mouse position when the mouse button is released. The camera should be associated with the environment map (5 Pt). Don’t use any backdrop image.
• Rotate the camera : Mouse Left Drag
• Change the distance of camera to the center: Mouse Right Drag
• Translate the camera: Mouse Middle Drag
• Rotate the light: Arrow keys
• Reset camera and light: “S” Key to reset the camera and light as a default one
B. Geometry Loader and Image Loader (35 Pts)
The user uses this tool to study the shader effects in different objects and different environment maps so that it should support to switch the 3d objects and textures. They should be pre-loaded and switched by the user input. The displayed object/images can be switched by pressing:
• 1: A box with six sides is displayed
• 2: A sphere
• 3: A torus
• 4:Ateapot
• 5: A bunny mesh model
• 6: Helicopter with Texture: (5 Pts)
• 7: Set the Skybox textures as test colors (5 Pts)
• 8: Set the Skybox textures as an office room(5 Pts)
• 9: Set the Skybox textures as a daytime sky(5 Pts)
• 0: Set the Skybox textures developed by yourself (15 Pts)
*) Note: you need to check for cube map seams – set the wrapping to the appropriate value
C. Reflection and Refraction Models (60 Pts)
The user uses this tool to study the material effects of different shader functions. All shaders MUST be per-pixel shading rather than the per-vertex one in Lab exercise. The shaders can be changed by pressing:
• F7. Reflection Shader (10 Pts)
• F8. Refraction Shader (10 Pts)
• F9. Refraction + Dispersion Shader (10 Pts)
• F10. Fresnel Shader (10 Pts)
• You should be able to change refraction index, all parameters for the Fresnel term, the environment maps, … in the interface. The good values should be set as a default value.
The reflectivity can be changed by pressing
• + (plus): Increases the intensity
• – (minus): Decreases the intensity
The Fresnel can be changed by pressing (5 Pts) • Q/q: Fresnel Power
• W/w: Fresnel Scale
• E/e: Fresnel Bias
The etaRatio for RBG can be controlled by pressing (5 Pts)
• R/r: Increase the eta ratio of red (+ Shift key: decrease)
• G/g: Increase the eta ratio of green (+ Shift key: decrease)
• B/b: Increase the green value of blue (+ Shift key: decrease)
*) Note: For refractive dispersion one needs to be able to find a set of parameters for which the effect looks really good. You have to be able to see the dispersion effect along bright edges in the sky box image. The dispersion should be a subtle effect. You need a convenient GUI that allows you to change the dispersion parameters in real time to find good settings.
*) Note: please note that the refraction looks bad if the camera is too far away from the object.
The text information can be displayed by pressing:
• ?: Show/hide the help screen showing the information of key/mouse controls (5 Pts) • H/h: Show/hide all parameter values used in the shader. (5 pts)
*** IMPORTANT ***
• Complete the section one by one, and submit a zipped file including the solution (.sln) file and the project folders to course online site. The submission item is located in the “Assignment” section. Each assignment has 100 points.
2
Assignment 2
• Don’t submit any project that does not run in your developing environment. In other words, if your project does not run/compile successfully, you will get 0 point. Back up the running version frequently during the development, and submit the last one, which does work even though all tasks are not implemented to get the partial points. The solution is demonstrated in the next class after the deadline.
Assignment 2
3