a4

Assignment Objectives:
1. Familiarization with skybox
2. Familiarization with environment mapping
3. Familiarization with reflection and refraction
4. Using skybox as a texture
5. Experimenting with creating dynamic waves
Deliverables:
1. Report including snapshots of the work that you completed
2. Software system.
3. Provide a read me file for testing your software.
1. Assignment total marks: 100%.
1. The provided code focuses on the skybox and environment mapping. Therefore, it does not
contain the solution and the sphere classes. If you wish you can copy the relevant code classes to
the previous tutorials.
2. The shader code (spherebox.vs) only computes the refracting vector at the entry point but not
at the exit. This is a “bug” in the software, which in this case is done on purpose. The reason
is that the value of the skybox is computed from the centre of the box regardless of the
location of the object (recall that the skybox is at infinity, so minor changes to the location of
the ray are negligible). Thus, by computing the “right” vector” is as if the refracting vector
will always be the same as the view vector as if the object is completely transparent.
1. Task 1 – Reflection and Refraction vectors
(55) Purpose:
a. Insights of refraction vectors (effect of Snell’s law on the visualization).
1. Download and compile the code. The program shows a sphere in the air which is textured
with respect to the surrounding skybox.
Code Help, Add WeChat: cstutorcs
2. Review the code which is relatively new
3. Look at the keyboard call back function and become familiar with the keys
4. (10) Using the ‘t’ key toggle between reflecting and refracting rays of the sky box. Here you
can also set the initial position of the sphere to another location (e.g., (400,0,0)
4.1. Explain the difference between the images of the ball, which are a result of using
refracting rays and reflecting rays. Using the ‘w’ and the ‘s’ keys move the camera
forward or backward. What is the effect of the refracting rays on the image on the ball.
4.2. Change the set of images from sky like skybox to using six cats. See function
initSolution() and repeat 4.1. Is it what you expected in 4.1? Can you explain why the
effect occurred. (5)
5. Using refracting rays (45)
5.1. (40) The sphereBox.vs file contains two parameters which specify the coefficient of light
between the income ray of light to the outgoing ray of light (see notes on Snell’s law).
Currently they are set to air and water.
Change the ratio between the two coefficients to:
a. inRefractFactor = outRefractFactor = 1.0; Describe what has happens (5). Provide
an explanation why did it happen (5).
b. inRefractFactor = 1.0 outRefractFactor = 4.0; Describe what has happened (5)
Provide an explanation why did it happen (5).
c. inRefractFactor = 4.0 outRefractFactor = 1.0; Describe what has happens? (5)
Provide an explanation why did it happen (5). Fix the code so that the issue in “c”
will not occur (10).
5.2. (5) Using a ratio of air and water move the camera forward until you enter the sphere
and leave it. What is the effect of moving through the sphere?
浙大学霸代写 加微信 cstutorcs
2. Task 2 – Create another skybox and
texture an object
with it (60) Purpose:
a. Using a hidden skybox as a texture. You can reuse any part of the code. Note, you may
want to create an object class.
1. (15) Create another sphere object in space (make sure that it is visible)
2. (15) Create a new skybox texture – using any images that you like (as long as they are all the
same size, e.g., all 64×64, 128×128, 512×512, etc.).
3. (20) Display the object while texturing the image using the new skybox texture. (Do not
display the new skybox).
4. (10) Try rotating the object at every time tick by 1 degree (not the camera). Did it work? If
it did not, can you explain why not? Can you fix it? How?
CS Help, Email: tutorcs@163.com